.hp-portal,
.hp-editor {
  --hp-ink: #1c2834;
  --hp-muted: #667584;
  --hp-line: #e6edf3;
  --hp-paper: #f3f6f8;
  --hp-card: #ffffff;
  --hp-navy: #1a3a5c;
  --hp-teal: #0e7c75;
  --hp-clay: #b8613d;
  --hp-pad: 14px;
  color: var(--hp-ink);
  font-family: Nunito, Outfit, sans-serif;
}

.hp-portal {
  padding: 4px 6px 28px;
}

.carousel > .hp-edit-float {
  position: absolute;
  top: 14px;
  right: 16px;
  z-index: 4;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 18px rgba(26, 58, 92, 0.16);
}

.hp-edit-link,
.hp-text-btn,
.hp-editor-actions a,
.hp-editor-actions button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #d5e0ea;
  background: #fff;
  color: var(--hp-navy);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
}

.hp-edit-link:hover,
.hp-text-btn:hover,
.hp-editor-actions a:hover,
.hp-editor-actions button:hover {
  color: var(--hp-teal);
  border-color: #b7d6d3;
  text-decoration: none;
}

.hp-editor-actions button.is-primary,
.hp-editor-actions a.is-primary {
  background: var(--hp-navy);
  border-color: var(--hp-navy);
  color: #fff;
}

.hp-editor-actions button.is-primary:hover,
.hp-editor-actions a.is-primary:hover {
  background: #24486e;
  color: #fff;
}

.hp-editor {
  margin-bottom: 8px;
}

.hp-editor-bar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.hp-editor-title {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--hp-navy);
}

.hp-editor-note,
.hp-status,
.hp-tray-empty {
  margin: 6px 0 0;
  color: var(--hp-muted);
  font-size: 13.5px;
  line-height: 1.5;
  max-width: 720px;
}

.hp-status.is-ok { color: var(--hp-teal); }
.hp-status.is-bad { color: #a33b32; }

.hp-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}

.hp-gap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #d5e0ea;
  background: #fff;
  color: var(--hp-navy);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 800;
}

.hp-gap input[type="range"] {
  width: 128px;
  margin: 0;
  accent-color: var(--hp-teal);
}

.hp-gap b {
  min-width: 38px;
  font-weight: 800;
}

.hp-tray {
  background: var(--hp-paper);
  border: 1px dashed #c9d6e2;
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.hp-tray-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hp-navy);
}

.hp-tray-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.hp-tray-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--hp-line);
  border-radius: 999px;
  padding: 6px 8px 6px 12px;
  font-size: 13px;
  font-weight: 800;
  color: var(--hp-ink);
}

.hp-tray-chip button {
  border: 0;
  background: var(--hp-teal);
  color: #fff;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.hp-editor-stage {
  overflow-x: auto;
  padding-bottom: 12px;
}

.hp-portal.is-edit .hp-board {
  min-width: 980px;
}

.hp-board.grid-stack {
  background: transparent;
}

.hp-board > .grid-stack-item > .grid-stack-item-content {
  overflow: hidden;
  border-radius: 18px;
  box-shadow: 0 1px 2px rgba(26, 58, 92, 0.06), 0 8px 18px rgba(26, 58, 92, 0.10);
}

.hp-card {
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--hp-card);
  border: 1px solid var(--hp-line);
  border-radius: 18px;
}

.hp-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: var(--hp-pad);
  border-bottom: 1px solid var(--hp-line);
  min-height: 52px;
}

.hp-card-title {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--hp-navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hp-card-title i {
  width: 18px;
  margin-right: 6px;
  color: var(--hp-teal);
  text-align: center;
}

.hp-card-title a {
  color: inherit;
  text-decoration: none;
}

.hp-card-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
  flex-shrink: 0;
}

.hp-card-tools a {
  white-space: nowrap;
  color: var(--hp-navy);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.hp-card-tools a:hover { color: var(--hp-teal); }

.hp-drag,
.hp-hide {
  border: 0;
  background: #f4f7fa;
  color: #5d6d7c;
  border-radius: 8px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.hp-drag { cursor: grab; }
.hp-hide { width: auto; padding: 0 8px; font-size: 11px; font-weight: 800; }
.hp-hide:hover { background: #fde8e6; color: #a33b32; }

.hp-card-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: var(--hp-pad);
}

.hp-card-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.hp-card.is-stat {
  background: #fff;
  position: relative;
}

.hp-card.is-stat .hp-card-body {
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: var(--hp-pad);
}

.hp-stat-tools {
  position: absolute;
  top: var(--hp-pad);
  right: var(--hp-pad);
  display: flex;
  gap: 6px;
  z-index: 2;
}

.hp-stat {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.hp-stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  flex: none;
}

.hp-stat.is-guru .hp-stat-icon { background: var(--hp-navy); }
.hp-stat.is-murid .hp-stat-icon { background: var(--hp-teal); }
.hp-stat.is-staf .hp-stat-icon { background: var(--hp-clay); }

.hp-stat-label {
  font-size: 13px;
  font-weight: 800;
  color: var(--hp-muted);
}

.hp-stat-value {
  font-size: 32px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--hp-ink);
}

.hp-feed {
  display: flex;
  flex-direction: column;
}

.hp-news,
.hp-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid #eef2f5;
  text-decoration: none;
  color: inherit;
}

.hp-feed > :first-child { padding-top: 0; }
.hp-feed > :last-child { border-bottom: 0; padding-bottom: 0; }

.hp-news img,
.hp-row-icon {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 14px;
  flex: none;
  background: #eef3f6;
}

.hp-row-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--hp-teal);
  background: #e7f5f4;
  font-size: 16px;
}

.hp-row-icon.is-bolt { color: #c47b12; background: #fff4e2; }
.hp-row-icon.is-mega { color: #a33b32; background: #fdeceb; padding: 0; overflow: hidden; }
.hp-row-icon.is-mega img { width: 28px; height: 28px; object-fit: contain; }

.hp-copy { min-width: 0; flex: 1; }

.hp-copy h3,
.hp-copy a.hp-link {
  margin: 0;
  font-size: 14.5px;
  font-weight: 800;
  line-height: 1.35;
  color: var(--hp-navy);
  text-decoration: none;
}

.hp-copy a.hp-link:hover { color: var(--hp-teal); }

.hp-meta {
  display: inline-block;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 800;
  color: var(--hp-muted);
}

.hp-excerpt {
  margin: 6px 0 0;
  font-size: 13.5px;
  line-height: 1.45;
  color: #3e4c59;
}

.hp-empty {
  padding: 18px 8px;
  text-align: center;
  color: var(--hp-muted);
  font-size: 14px;
}

.hp-empty i {
  display: block;
  font-size: 22px;
  margin-bottom: 8px;
  color: #9aabba;
}

.hp-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 8px;
}

.hp-metric {
  display: block;
  padding: 10px 10px 8px;
  border-radius: 14px;
  background: #f6f8fa;
  text-decoration: none;
  color: inherit;
  min-height: 72px;
}

.hp-metric:hover { background: #e7f5f4; text-decoration: none; color: inherit; }

.hp-metric span {
  display: block;
  font-size: 12px;
  font-weight: 800;
  color: var(--hp-muted);
}

.hp-metric strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--hp-navy);
}

.hp-apps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 8px;
  align-content: start;
}

.hp-app {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  text-align: center;
  text-decoration: none;
  color: var(--hp-ink);
  background: #f6f8fa;
  border-radius: 14px;
  padding: 12px 8px 10px;
  min-height: 104px;
  overflow: hidden;
}

.hp-app:hover {
  background: #e7f5f4;
  text-decoration: none;
  color: var(--hp-navy);
}

.hp-app-icon {
  height: 40px;
  width: 100%;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hp-app-icon img {
  max-height: 36px;
  max-width: 72px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.hp-app-icon i { font-size: 26px; color: var(--hp-teal); }

.hp-app-name {
  font-size: 12.5px;
  font-weight: 800;
  line-height: 1.3;
}

.hp-houses { display: flex; flex-direction: column; gap: 8px; }

.hp-house {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  border-radius: 14px;
  padding: 8px 10px;
}

.hp-house-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 13.5px;
}

.hp-house-name img { height: 36px; width: auto; }

.hp-medals {
  display: flex;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
}

.hp-medals span { white-space: nowrap; }
.hp-rank {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.04em;
  min-width: 28px;
  text-align: right;
}

.hp-events { display: flex; flex-direction: column; gap: 8px; }

.hp-event {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  padding-bottom: 8px;
  border-bottom: 1px solid #eef2f5;
}

.hp-event:last-child { border-bottom: 0; padding-bottom: 0; }
.hp-event:hover { text-decoration: none; color: inherit; }

.hp-event-date {
  text-align: center;
  border-radius: 12px;
  background: #f6f8fa;
  padding: 6px 0;
}

.hp-event-date strong {
  display: block;
  font-size: 20px;
  line-height: 1;
  color: #e0a106;
}

.hp-event-date span {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--hp-muted);
}

.hp-event h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  color: var(--hp-navy);
  line-height: 1.35;
}

.hp-event p {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--hp-muted);
}

.hp-tag {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 99px;
  margin-right: 4px;
}

.hp-month {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.hp-month a {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f4f7fa;
  color: var(--hp-navy);
  text-decoration: none;
}

.hp-card-body:has(.hp-celebrate) {
  padding: 0;
}

.hp-celebrate {
  margin: 0;
  padding: 0 16px 16px;
  min-height: 100%;
  background: #1a3a5c url("../images/bgbesday.jpg") center/cover no-repeat;
  color: #fff;
}

.hp-bday-banner {
  height: 72px;
  margin: 0 0 12px;
  background: url("../images/icons/besday.png") center / auto 72px repeat-x;
}

.hp-celebrate .hp-chip {
  display: inline-block;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 4px 10px;
  font-weight: 800;
  margin-bottom: 8px;
}

.hp-celebrate ul {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
}

.hp-celebrate li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 14px;
  font-weight: 700;
}

.hp-celebrate img.hp-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
}

.hp-celebrate .badge { font-size: 11px; }

.hp-wish {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: #ffe08a;
  font-size: 13.5px;
  line-height: 1.45;
}

.hp-wish img { width: 42px; flex: none; }

.hp-quiet {
  text-align: center;
  padding: 12px 8px 4px;
}

.hp-quiet img { width: 72px; }
.hp-quiet p { margin: 8px 0 0; }

.hp-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 6px;
}

.hp-photos a {
  display: block;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  background: #eef3f6;
}

.hp-photos img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hp-board .grid-stack-placeholder > .placeholder-content {
  background: rgba(14, 124, 117, 0.12);
  border: 1.5px dashed var(--hp-teal);
  border-radius: 18px;
}

.hp-portal.is-edit .grid-stack-item > .ui-resizable-se {
  width: 18px;
  height: 18px;
  right: 8px;
  bottom: 8px;
}

.hp-toast {
  --hp-navy: #1a3a5c;
  --hp-teal: #0e7c75;
  --hp-muted: #667584;
  --hp-line: #e6edf3;
  position: fixed;
  z-index: 1020;
  top: 84px;
  right: 16px;
  width: min(340px, calc(100vw - 32px));
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0;
  padding: 14px 10px 14px 14px;
  background: #fff;
  color: var(--hp-navy);
  border: 1px solid var(--hp-line);
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(26, 58, 92, 0.06), 0 14px 32px rgba(26, 58, 92, 0.16);
  font-family: Nunito, Outfit, sans-serif;
  animation: hp-toast-in 0.22s ease;
}

.hp-toast.is-out {
  animation: hp-toast-out 0.18s ease forwards;
}

.hp-toast-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  background: #e7f6f4;
  color: var(--hp-teal);
  font-size: 14px;
}

.hp-toast.is-bad .hp-toast-icon {
  background: #fdecea;
  color: #a33b32;
}

.hp-toast-copy {
  flex: 1;
  min-width: 0;
  padding-top: 1px;
}

.hp-toast-copy strong {
  display: block;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.hp-toast-copy span {
  display: block;
  margin-top: 3px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--hp-muted);
}

.hp-toast-x {
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #8b9aab;
  flex: none;
  cursor: pointer;
}

.hp-toast-x:hover {
  background: #f3f6f8;
  color: var(--hp-navy);
}

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

@keyframes hp-toast-out {
  from { opacity: 1; }
  to { opacity: 0; transform: translateY(-6px); }
}

@media (max-width: 720px) {
  .hp-editor-bar { align-items: stretch; flex-direction: column; }
  .hp-editor-actions { justify-content: flex-start; }
  .carousel > .hp-edit-float { top: 10px; right: 10px; padding: 7px 11px; }
  .hp-toast { top: 72px; }
}
