:root {
  color-scheme: light;
  --bg: #fbfaff;
  --bg-soft: #f4efff;
  --panel: rgba(255, 255, 255, .86);
  --panel-solid: #ffffff;
  --text: #251d31;
  --muted: #756b82;
  --line: #e8e1f1;
  --primary: #6d4c9f;
  --primary-dark: #4b2f73;
  --primary-soft: #f0e8ff;
  --coral: #ff6b5f;
  --gold: #e8bd4a;
  --violet: #8f6be8;
  --sky: #37b7d7;
  --mint: #43c59e;
  --danger: #d94d5c;
  --ok: #16845b;
  --shadow: 0 20px 52px rgba(48, 31, 80, .13);
  --shadow-soft: 0 10px 28px rgba(48, 31, 80, .08);
  --shadow-color: 109, 76, 159;
  --radius: 8px;
  --font: "Prompt", "Noto Sans Thai", "Sarabun", "IBM Plex Sans Thai", "Segoe UI", Tahoma, sans-serif;
  font-family: var(--font);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(120deg, rgba(109, 76, 159, .12), transparent 28%),
    linear-gradient(240deg, rgba(232, 189, 74, .16), transparent 30%),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 42%, #f7f3ff 100%);
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.62;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(109, 76, 159, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(109, 76, 159, .045) 1px, transparent 1px),
    linear-gradient(135deg, transparent 0 44%, rgba(232, 189, 74, .08) 44% 46%, transparent 46% 100%);
  background-size: 34px 34px, 34px 34px, 180px 180px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, .8), transparent 70%);
  animation: background-drift 18s linear infinite;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    linear-gradient(115deg, rgba(109, 76, 159, .08) 0 12%, transparent 12% 36%, rgba(55, 183, 215, .07) 36% 48%, transparent 48% 100%),
    linear-gradient(72deg, transparent 0 58%, rgba(255, 107, 95, .08) 58% 67%, transparent 67% 100%);
  background-size: 520px 520px, 620px 620px;
  animation: color-ribbon 24s ease-in-out infinite alternate;
}

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

.loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  width: 100%;
  height: 3px;
  overflow: hidden;
  background: rgba(109, 76, 159, .08);
}

.loading-bar::before {
  content: "";
  display: block;
  width: 42%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--coral), var(--gold));
  animation: loading-slide 1.2s ease-in-out infinite;
}

body.is-loaded .loading-bar {
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .28s ease, transform .28s ease;
}

@keyframes loading-slide {
  0% { transform: translateX(-110%); }
  55% { transform: translateX(95%); }
  100% { transform: translateX(250%); }
}

@keyframes background-drift {
  from { background-position: 0 0, 0 0, 0 0; }
  to { background-position: 68px 68px, 68px 68px, 180px 180px; }
}

@keyframes color-ribbon {
  from { transform: translate3d(-18px, -10px, 0); opacity: .88; }
  to { transform: translate3d(18px, 16px, 0); opacity: 1; }
}

@keyframes accent-flow {
  from { background-position: 0 0; }
  to { background-position: 220% 0; }
}

@keyframes mark-glow {
  from { background-position: 0 50%; box-shadow: 0 14px 28px rgba(109, 76, 159, .2); }
  to { background-position: 100% 50%; box-shadow: 0 16px 34px rgba(55, 183, 215, .22); }
}

@keyframes icon-sheen {
  0%, 38% { transform: translateX(-85%) rotate(18deg); }
  58%, 100% { transform: translateX(85%) rotate(18deg); }
}

@keyframes menu-pop {
  from { opacity: 0; transform: translateY(-6px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes panel-sheen {
  0%, 45% { background-position: -260px 0, 0 0; }
  75%, 100% { background-position: 260px 0, 0 0; }
}

@keyframes hero-gradient {
  from { background-position: 0 50%, 0 0; }
  to { background-position: 100% 50%, 0 0; }
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px clamp(12px, 2.4vw, 26px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .92), rgba(255, 255, 255, .82)),
    rgba(255, 255, 255, .82);
  border-bottom: 1px solid rgba(232, 225, 241, .92);
  box-shadow: 0 10px 34px rgba(48, 31, 80, .06);
  backdrop-filter: blur(18px);
}

.topbar::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  pointer-events: none;
  background: linear-gradient(90deg, var(--primary), var(--sky), var(--gold), var(--coral), var(--violet));
  background-size: 220% 100%;
  animation: accent-flow 8s linear infinite;
}

.brand {
  display: flex;
  min-width: 210px;
  align-items: center;
  gap: 12px;
  color: var(--text);
}

.brand-mark {
  position: relative;
  overflow: hidden;
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border-radius: 8px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary), var(--violet), var(--sky));
  background-size: 180% 180%;
  box-shadow: 0 14px 28px rgba(109, 76, 159, .22);
  animation: mark-glow 7s ease-in-out infinite alternate;
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: -40%;
  background: linear-gradient(120deg, transparent 35%, rgba(255, 255, 255, .42), transparent 65%);
  transform: translateX(-80%) rotate(18deg);
  animation: icon-sheen 5.5s ease-in-out infinite;
}

.brand-mark .icon {
  position: relative;
  z-index: 1;
}

.brand-mark .icon {
  width: 24px;
  height: 24px;
  stroke-width: 2.2;
}

.brand strong {
  display: block;
  line-height: 1.2;
  letter-spacing: 0;
  font-size: 15px;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  align-items: center;
}

.nav a,
.nav-more summary {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 9px;
  border-radius: 8px;
  color: #26383d;
  font-size: 13.5px;
  transition: color .18s ease, background .18s ease, transform .18s ease, box-shadow .18s ease;
}

.nav a::after,
.nav-more summary::after {
  content: "";
  position: absolute;
  right: 10px;
  bottom: 4px;
  left: 10px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), var(--coral));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .2s ease;
}

.nav a:hover,
.nav-more summary:hover {
  color: var(--primary-dark);
  background: var(--primary-soft);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(109, 76, 159, .1);
}

.nav a:hover::after,
.nav-more summary:hover::after {
  transform: scaleX(1);
}

.nav a.active,
.nav-more summary.active {
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark), var(--violet));
  background-size: 180% 180%;
  box-shadow: 0 8px 18px rgba(109, 76, 159, .18);
}

.nav-more {
  position: relative;
}

.nav-more summary {
  list-style: none;
  cursor: pointer;
}

.nav-more summary::-webkit-details-marker {
  display: none;
}

.nav-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 30;
  display: grid;
  min-width: 190px;
  gap: 4px;
  padding: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(251, 250, 255, .96)),
    #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transform-origin: top right;
  animation: menu-pop .16s ease-out both;
}

.nav-menu a {
  justify-content: flex-start;
  width: 100%;
}

.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.page {
  width: min(1240px, calc(100% - 30px));
  margin: 24px auto 42px;
  animation: page-in .34s ease-out both;
}

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

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.credit {
  color: var(--primary-dark);
  font-weight: 700;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.16fr) minmax(320px, .84fr);
  gap: 24px;
  align-items: stretch;
  overflow: hidden;
  padding: clamp(20px, 3.2vw, 34px);
  background:
    linear-gradient(135deg, rgba(109, 76, 159, .12), rgba(55, 183, 215, .08) 52%, rgba(232, 189, 74, .1)),
    rgba(255, 255, 255, .78);
  border: 1px solid rgba(223, 233, 235, .92);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(120deg, transparent 0 62%, rgba(255, 255, 255, .46) 62% 64%, transparent 64% 100%),
    linear-gradient(90deg, rgba(255, 255, 255, .25), transparent);
  background-size: 320px 320px, 100% 100%;
  animation: panel-sheen 10s ease-in-out infinite;
}

.hero::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 220px;
  height: 220px;
  background:
    linear-gradient(135deg, rgba(255, 107, 95, .2), rgba(232, 189, 74, .18));
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
  pointer-events: none;
}

.hero > * {
  position: relative;
  z-index: 1;
}

.hero h1,
.section-title h1 {
  margin: 0 0 8px;
  color: #10262b;
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 720;
  letter-spacing: 0;
  line-height: 1.18;
}

.hero p,
.section-title p {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
}

.home-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, .72fr);
  gap: clamp(18px, 3vw, 34px);
  align-items: center;
  min-height: clamp(520px, calc(100vh - 170px), 680px);
  overflow: hidden;
  padding: clamp(24px, 5vw, 58px);
  color: #ffffff;
  background:
    linear-gradient(135deg, rgba(75, 47, 115, .95), rgba(109, 76, 159, .9) 42%, rgba(55, 183, 215, .82)),
    linear-gradient(180deg, #6d4c9f, #4b2f73);
  background-size: 160% 160%, 100% 100%;
  border-radius: var(--radius);
  box-shadow: 0 24px 70px rgba(75, 47, 115, .24);
  animation: hero-gradient 14s ease-in-out infinite alternate;
}

.home-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, .08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .08) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(90deg, rgba(0, 0, 0, .7), transparent 72%);
}

.home-hero::after {
  content: "";
  position: absolute;
  right: -40px;
  bottom: 0;
  width: 42%;
  height: 62%;
  pointer-events: none;
  background:
    linear-gradient(135deg, transparent 0 38%, rgba(255, 255, 255, .13) 38% 44%, transparent 44% 100%),
    linear-gradient(45deg, rgba(232, 189, 74, .18), transparent 55%);
  clip-path: polygon(32% 0, 100% 0, 100% 100%, 0 100%);
}

.home-hero-copy,
.home-verify-card {
  position: relative;
  z-index: 1;
}

.home-kicker {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 16px;
  padding: 8px 12px;
  color: #dff8f6;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 999px;
  font-weight: 700;
}

.home-hero h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(34px, 5vw, 64px);
  font-weight: 800;
  line-height: 1.08;
}

.home-hero p {
  max-width: 680px;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, .82);
  font-size: clamp(15px, 1.5vw, 18px);
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.home-actions .btn:first-child {
  color: var(--primary-dark);
  background: #ffffff;
  box-shadow: 0 16px 34px rgba(0, 0, 0, .16);
}

.home-actions .btn.secondary {
  color: #ffffff;
  background: rgba(255, 255, 255, .12);
  border-color: rgba(255, 255, 255, .28);
}

.home-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-width: 620px;
  margin-top: 28px;
}

.home-stats span {
  display: grid;
  gap: 2px;
  padding: 14px;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 8px;
}

.home-stats strong {
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1;
}

.home-verify-card {
  padding: clamp(16px, 2.4vw, 24px);
  color: var(--text);
  background: rgba(255, 255, 255, .94);
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: var(--radius);
  box-shadow: 0 24px 56px rgba(0, 0, 0, .18);
}

.verify-card-head {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}

.verify-card-head > span {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary), var(--violet));
  border-radius: 8px;
}

.verify-card-head h2,
.verify-card-head p {
  margin: 0;
}

.verify-card-head h2 {
  font-size: 22px;
}

.verify-card-head p {
  color: var(--muted);
}

.home-verify-card form {
  display: grid;
  gap: 12px;
}

.home-verify-card button {
  width: 100%;
}

.verify-help {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  color: #42585d;
  border-top: 1px solid var(--line);
  font-weight: 700;
}

.verify-help span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.verify-help .icon {
  color: var(--ok);
}

.home-preview {
  display: grid;
  grid-template-columns: minmax(320px, .9fr) minmax(0, 1.1fr);
  gap: 18px;
  align-items: stretch;
  margin-top: 18px;
}

.certificate-mock {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 8px;
  overflow: hidden;
  min-height: 360px;
  padding: 34px;
  text-align: center;
  background:
    linear-gradient(rgba(255, 253, 247, .94), rgba(255, 253, 247, .94)),
    #fffdf7;
  border: 10px double var(--gold);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.certificate-mock::before {
  content: "";
  position: absolute;
  left: -60px;
  top: -80px;
  width: 220px;
  height: 420px;
  background: linear-gradient(180deg, rgba(122, 111, 240, .1), rgba(109, 76, 159, .08));
  transform: rotate(35deg);
}

.certificate-mock > * {
  position: relative;
  z-index: 1;
}

.mock-logo {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary), var(--violet));
  border-radius: 50%;
}

.certificate-mock small {
  color: var(--primary-dark);
  font-weight: 800;
}

.certificate-mock h2 {
  margin: 4px 0 0;
  font-size: 40px;
  line-height: 1.1;
}

.certificate-mock p,
.certificate-mock em {
  margin: 0;
  color: var(--muted);
  font-style: normal;
}

.certificate-mock strong {
  width: min(100%, 420px);
  padding: 8px 0 10px;
  border-bottom: 2px solid var(--gold);
  font-size: 30px;
}

.mock-footer {
  display: flex;
  width: 100%;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  color: var(--muted);
  font-weight: 700;
}

.mock-qr {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  color: #ffffff;
  background: #222;
  border-radius: 6px;
}

.home-feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.home-feature-grid article,
.home-steps div {
  padding: 18px;
  background: rgba(255, 255, 255, .9);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.home-feature-grid .icon {
  width: 26px;
  height: 26px;
  color: var(--primary);
}

.home-feature-grid h3,
.home-feature-grid p,
.home-steps h3,
.home-steps p {
  margin: 0;
}

.home-feature-grid h3 {
  margin-top: 12px;
}

.home-feature-grid p,
.home-steps p {
  margin-top: 6px;
  color: var(--muted);
}

.home-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.home-steps span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  margin-bottom: 12px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary), var(--coral));
  border-radius: 50%;
  font-weight: 800;
}

.home-search-results {
  margin-top: 18px;
  padding: clamp(16px, 2vw, 22px);
  background: rgba(255, 255, 255, .9);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.public-result-list {
  display: grid;
  gap: 12px;
}

.public-result-card {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 16px;
  background: #ffffff;
  border: 1px solid #e8e1f1;
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(48, 31, 80, .06);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.public-result-card h3,
.public-result-card p {
  margin: 0;
}

.public-result-card h3 {
  font-size: 20px;
}

.public-result-card p {
  margin-top: 4px;
  color: #30464b;
}

.public-result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.public-result-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  color: #40565b;
  background: #fbfaff;
  border: 1px solid #e8e1f1;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.public-result-meta .icon {
  width: 15px;
  height: 15px;
  color: var(--primary);
}

.public-result-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 260px;
}

.home-activity-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, .46fr);
  gap: 18px;
  align-items: start;
  margin-top: 18px;
}

.home-activity-list,
.activity-calendar {
  min-width: 0;
}

.activity-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.activity-card {
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, .92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.activity-card-cover {
  position: relative;
  display: grid;
  min-height: 150px;
  place-items: center;
  color: #ffffff;
  background:
    linear-gradient(135deg, rgba(109, 76, 159, .9), rgba(55, 183, 215, .75)),
    linear-gradient(45deg, #6d4c9f, #e8bd4a);
  background-size: 160% 160%, 100% 100%;
  animation: hero-gradient 12s ease-in-out infinite alternate;
}

.activity-card-cover::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .12) 1px, transparent 1px);
  background-size: 28px 28px;
}

.activity-card-cover > * {
  position: relative;
  z-index: 1;
}

.activity-card-cover .icon {
  width: 34px;
  height: 34px;
  margin-bottom: 4px;
}

.activity-card-cover strong {
  font-size: 38px;
  line-height: 1;
}

.activity-card-cover small {
  color: rgba(255, 255, 255, .86);
  font-weight: 700;
}

.activity-card-body {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.activity-card-body h3,
.activity-card-body p {
  margin: 0;
}

.activity-card-body h3 {
  display: -webkit-box;
  min-height: 58px;
  overflow: hidden;
  font-size: 20px;
  line-height: 1.42;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.activity-card-body p {
  color: var(--muted);
  font-weight: 700;
}

.activity-meta {
  display: grid;
  gap: 6px;
  color: #40565b;
  font-size: 13px;
  font-weight: 700;
}

.activity-meta span {
  display: flex;
  align-items: center;
  gap: 7px;
}

.activity-meta .icon {
  width: 16px;
  height: 16px;
  color: var(--primary);
}

.activity-calendar {
  padding: 18px;
  background: rgba(255, 255, 255, .94);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.calendar-head {
  display: flex;
  gap: 12px;
  align-items: center;
}

.calendar-head > span {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #ffffff;
  background: #22292d;
  border-radius: 8px;
}

.calendar-head h2,
.calendar-head p,
.activity-calendar h3 {
  margin: 0;
}

.calendar-head h2 {
  font-size: 22px;
}

.calendar-head p {
  color: var(--muted);
}

.activity-calendar h3 {
  margin: 18px 0 12px;
  font-size: 30px;
  text-align: center;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.calendar-grid b,
.calendar-cell {
  min-width: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.calendar-grid b:nth-child(7n),
.calendar-cell:nth-child(7n) {
  border-right: 0;
}

.calendar-grid b {
  padding: 8px 4px;
  color: var(--primary-dark);
  background: #fbfaff;
  font-size: 13px;
  text-align: center;
}

.calendar-cell {
  display: grid;
  align-content: start;
  gap: 4px;
  min-height: 82px;
  padding: 7px;
  background: #ffffff;
}

.calendar-cell strong {
  justify-self: end;
  color: #26383d;
  font-size: 14px;
}

.calendar-cell.muted {
  background: #f8fbfb;
}

.calendar-cell.has-event {
  background: #fffaf2;
}

.calendar-cell a {
  display: block;
  overflow: hidden;
  padding: 3px 5px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--coral), var(--gold));
  border-radius: 5px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-cell em {
  color: var(--primary-dark);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.panel,
.stat {
  position: relative;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid rgba(232, 225, 241, .95);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(109, 76, 159, .12), rgba(55, 183, 215, .08), rgba(232, 189, 74, .12)) top / 100% 3px no-repeat,
    linear-gradient(135deg, rgba(255, 255, 255, .48), transparent 34%);
  opacity: .8;
}

.panel > * {
  position: relative;
  z-index: 1;
}

.panel:hover {
  transform: translateY(-1px);
  border-color: rgba(109, 76, 159, .22);
  box-shadow: var(--shadow);
}

.panel {
  padding: clamp(14px, 1.8vw, 19px);
}

.panel h2 {
  margin: 0 0 14px;
  font-size: 18px;
  letter-spacing: 0;
}

.compact-title {
  margin-bottom: 12px;
}

.compact-title h2 {
  margin: 0 0 4px;
}

.form-section {
  margin: 16px 0 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.form-section h3 {
  margin: 0 0 2px;
  font-size: 15px;
}

.form-section p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.hint-box {
  margin: 0 0 12px;
  padding: 10px 12px;
  color: #476166;
  background: #faf7ff;
  border: 1px solid #d7eaeb;
  border-radius: var(--radius);
  font-size: 13px;
}

.layout-hidden {
  display: none;
}

.template-designer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 16px;
  align-items: start;
  margin-bottom: 14px;
}

.designer-stage {
  overflow: auto;
  padding: 14px;
  max-width: 100%;
  background: #f5f0ff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.designer-paper {
  position: relative;
  box-sizing: border-box;
  width: 1120px;
  max-width: none;
  aspect-ratio: 1120 / 790;
  margin: 0 auto;
  overflow: hidden;
  background:
    linear-gradient(rgba(255, 253, 247, .92), rgba(255, 253, 247, .92)),
    #fffdf7;
  background-size: cover;
  background-position: center;
  border: 12px double var(--cert-border, #e8bd4a);
  box-shadow: 0 18px 34px rgba(21, 39, 43, .13);
}

.designer-paper::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  background-image:
    linear-gradient(rgba(109, 76, 159, .22) 1px, transparent 1px),
    linear-gradient(90deg, rgba(109, 76, 159, .22) 1px, transparent 1px),
    linear-gradient(rgba(216, 183, 106, .26) 1px, transparent 1px),
    linear-gradient(90deg, rgba(216, 183, 106, .26) 1px, transparent 1px);
  background-size:
    5% 5%,
    5% 5%,
    10% 10%,
    10% 10%;
  transition: opacity .16s ease;
}

.designer-paper.show-grid::before {
  opacity: 1;
}

.designer-guide {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  background: rgba(217, 77, 92, .9);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .75);
  transition: opacity .12s ease;
}

.designer-guide.visible {
  opacity: 1;
}

.designer-guide.guide-x {
  top: 0;
  bottom: 0;
  width: 2px;
  transform: translateX(-1px);
}

.designer-guide.guide-y {
  left: 0;
  right: 0;
  height: 2px;
  transform: translateY(-1px);
}

.designer-paper.portrait {
  width: 790px;
  max-width: none;
  aspect-ratio: 790 / 1120;
}

.designer-item {
  position: absolute;
  z-index: 2;
  display: block;
  min-height: 24px;
  padding: 0;
  overflow: hidden;
  color: #222;
  background: rgba(255, 255, 255, .62);
  border: 1px dashed rgba(109, 76, 159, .45);
  border-radius: 6px;
  box-shadow: none;
  line-height: 1.35;
  white-space: normal;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.designer-item:hover,
.designer-item.active {
  background: rgba(221, 245, 243, .76);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(109, 76, 159, .13);
}

.designer-item:active {
  cursor: grabbing;
}

.designer-item.editing,
.designer-item[contenteditable="true"] {
  cursor: text;
  user-select: text;
  white-space: pre-wrap;
  background: rgba(255, 255, 255, .94);
  border-style: solid;
  border-color: var(--primary);
  outline: 3px solid rgba(109, 76, 159, .18);
}

.designer-item.editing:active {
  cursor: text;
}

.designer-title {
  color: var(--cert-theme, #6d4c9f);
  font-weight: 800;
}

.designer-recipient {
  border-bottom: 2px solid var(--cert-border, #e8bd4a);
  padding-bottom: 8px;
  font-weight: 800;
}

.designer-logo,
.designer-qr {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
}

.designer-logo-img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
}

.designer-qr-box {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  background:
    linear-gradient(90deg, #222 10px, transparent 0) 0 0 / 18px 18px,
    linear-gradient(#222 10px, transparent 0) 0 0 / 18px 18px,
    #fff;
  border: 2px solid #222;
  font-size: .8em;
}

.designer-controls {
  position: sticky;
  top: 92px;
  display: grid;
  gap: 10px;
  padding: 14px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.designer-controls label {
  margin: 0;
}

.designer-toggles {
  display: grid;
  gap: 7px;
  padding: 10px;
  background: #f7fbfb;
  border: 1px solid #e8e1f1;
  border-radius: 8px;
}

.designer-toggles label {
  display: flex;
  align-items: center;
  flex-direction: row;
  gap: 8px;
  color: #30464b;
  font-size: 13px;
  font-weight: 700;
}

.measure-field {
  gap: 7px;
}

.measure-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 76px;
  gap: 8px;
  align-items: center;
}

.designer-number {
  min-height: 38px;
  padding: 7px 8px;
  text-align: center;
}

.designer-actions {
  display: grid;
  grid-template-columns: 1fr;
}

.designer-controls .range-field {
  gap: 7px;
}

.designer-controls .range-field span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.designer-controls output {
  min-width: 58px;
  padding: 2px 8px;
  color: #0d555c;
  background: #f3edff;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.designer-controls input[type="range"] {
  padding: 0;
  accent-color: var(--primary);
}

.grid {
  display: grid;
  gap: 16px;
}

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

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.workspace-narrow {
  max-width: 940px;
  margin: 0 auto;
}

.workspace-designer {
  width: min(1500px, calc(100vw - 30px));
  max-width: 1500px;
  margin-left: 50%;
  transform: translateX(-50%);
}

.stats {
  margin: 18px 0;
}

.stat {
  padding: 15px;
}

.stat::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--coral), var(--gold));
}

.stat:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.stat:nth-child(4n + 1)::before {
  background: linear-gradient(90deg, var(--primary), var(--violet));
}

.stat:nth-child(4n + 2)::before {
  background: linear-gradient(90deg, var(--sky), var(--mint));
}

.stat:nth-child(4n + 3)::before {
  background: linear-gradient(90deg, var(--gold), var(--coral));
}

.stat:nth-child(4n + 4)::before {
  background: linear-gradient(90deg, var(--violet), var(--sky));
}

.stat strong {
  display: block;
  color: #10262b;
  font-size: 27px;
  line-height: 1.1;
}

.stat span {
  color: var(--muted);
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 18px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.actions form {
  margin: 0;
}

td.actions,
td .actions {
  align-items: flex-start;
}

.btn,
button,
input[type="submit"] {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark), var(--violet));
  background-size: 180% 180%;
  color: #ffffff;
  font: inherit;
  font-size: 13.5px;
  font-weight: 620;
  letter-spacing: 0;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(109, 76, 159, .18);
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease;
}

.btn::after,
button::after,
input[type="submit"]::after {
  content: "";
  position: absolute;
  inset: -40% auto -40% -70%;
  width: 48%;
  pointer-events: none;
  background: linear-gradient(120deg, transparent, rgba(255, 255, 255, .38), transparent);
  transform: skewX(-18deg);
  transition: left .45s ease;
}

.btn:hover,
button:hover,
input[type="submit"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(109, 76, 159, .23);
  background-position: 100% 50%;
}

.btn:hover::after,
button:hover::after,
input[type="submit"]:hover::after {
  left: 130%;
}

.btn.secondary {
  background:
    linear-gradient(#ffffff, #ffffff) padding-box,
    linear-gradient(135deg, rgba(109, 76, 159, .36), rgba(55, 183, 215, .2), rgba(232, 189, 74, .3)) border-box;
  color: var(--primary-dark);
  border-color: transparent;
  box-shadow: none;
}

.btn.secondary:hover {
  background: var(--primary-soft);
  border-color: #c7b4e3;
}

.btn.danger,
button.danger {
  border-color: transparent;
  background: linear-gradient(135deg, var(--danger), #ad3342, var(--coral));
  color: #ffffff;
}

label {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

input,
select,
textarea {
  display: block;
  width: 100%;
  min-height: 38px;
  margin-top: 6px;
  padding: 8px 10px;
  border: 1px solid #ded2ee;
  border-radius: 8px;
  outline: 0;
  background:
    linear-gradient(#ffffff, #ffffff) padding-box,
    linear-gradient(135deg, rgba(109, 76, 159, .12), rgba(55, 183, 215, .08)) border-box;
  color: var(--text);
  font: inherit;
  font-weight: 450;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(109, 76, 159, .12);
  background:
    linear-gradient(#ffffff, #ffffff) padding-box,
    linear-gradient(135deg, var(--primary), var(--sky), var(--gold)) border-box;
}

input[type="color"] {
  min-height: 44px;
  padding: 4px;
}

input[type="checkbox"] {
  display: inline-grid;
  width: 18px;
  min-height: 18px;
  margin: 0 8px 0 0;
  vertical-align: middle;
  accent-color: var(--primary);
}

textarea {
  min-height: 112px;
  resize: vertical;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  background:
    linear-gradient(#ffffff, #ffffff) padding-box,
    linear-gradient(135deg, rgba(109, 76, 159, .22), rgba(55, 183, 215, .12), rgba(232, 189, 74, .18)) border-box;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

th,
td {
  padding: 10px 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: linear-gradient(180deg, #fbf8ff, #f0e8ff);
  color: #3a2b4f;
  font-size: 13px;
  font-weight: 750;
}

tbody tr {
  transition: background .16s ease, transform .16s ease;
}

tbody tr:hover {
  background: linear-gradient(90deg, rgba(109, 76, 159, .06), rgba(255, 255, 255, .92));
}

tr:last-child td {
  border-bottom: 0;
}

small {
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  background: linear-gradient(135deg, #eaf8f1, #f4fff7);
  color: var(--ok);
  font-size: 13px;
  font-style: normal;
  font-weight: 700;
}

.badge.muted {
  background: #f4f1fa;
  color: var(--muted);
}

.badge.danger {
  background: linear-gradient(135deg, #fff0f1, #fff7f0);
  color: var(--danger);
}

.registry-panel {
  margin-top: 16px;
}

.event-card-grid {
  display: grid;
  gap: 14px;
}

.event-card {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .96), rgba(251, 250, 255, .92)),
    rgba(255, 255, 255, .92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.event-card::before,
.registry-card::before,
.public-result-card::before,
.activity-card::before,
.shortcut-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--primary), var(--sky), var(--gold));
  opacity: .9;
}

.event-card:hover,
.registry-card:hover,
.public-result-card:hover,
.activity-card:hover,
.shortcut-card:hover {
  transform: translateY(-3px);
  border-color: rgba(109, 76, 159, .24);
  box-shadow: var(--shadow);
}

.event-card-main h2,
.event-card-main p {
  margin: 0;
}

.event-card-main h2 {
  margin-top: 8px;
  font-size: 22px;
}

.event-card-main p {
  margin-top: 4px;
  color: var(--muted);
  font-weight: 700;
}

.event-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.event-card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  color: #40565b;
  background: #fbfaff;
  border: 1px solid #e8e1f1;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.event-card-meta .icon {
  width: 15px;
  height: 15px;
  color: var(--primary);
}

.event-card-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 470px;
}

.registry-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.registry-head h2 {
  margin: 0;
  font-size: 22px;
}

.registry-head p {
  margin: 2px 0 0;
  color: var(--muted);
}

.registry-list {
  display: grid;
  gap: 12px;
}

.registry-card {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) minmax(300px, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 16px;
  background: rgba(255, 255, 255, .92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.registry-code {
  display: inline-flex;
  margin-bottom: 6px;
  color: var(--primary);
  font-size: 18px;
  font-weight: 800;
}

.registry-main h3 {
  margin: 0;
  font-size: 20px;
}

.registry-main p {
  margin: 4px 0 0;
  color: #30464b;
}

.registry-sub {
  display: inline-flex;
  margin-top: 8px;
  color: var(--muted);
  font-weight: 700;
}

.registry-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.registry-meta span {
  display: grid;
  gap: 4px;
  min-height: 58px;
  padding: 10px 12px;
  background: #f7fbfb;
  border: 1px solid #e8e1f1;
  border-radius: 8px;
}

.registry-meta strong {
  color: var(--muted);
  font-size: 12px;
}

.registry-meta .badge {
  justify-self: start;
}

.registry-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 290px;
}

.registry-more {
  position: relative;
}

.registry-more summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  color: var(--primary);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}

.registry-more summary::-webkit-details-marker {
  display: none;
}

.registry-more[open] summary {
  background: #f3edff;
  border-color: #cce4e6;
}

.registry-more-body {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  gap: 12px;
  width: min(330px, calc(100vw - 32px));
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.registry-more-body button,
.registry-more-body .btn {
  width: 100%;
}

.registry-reason-form {
  display: grid;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.registry-reason-form label {
  margin: 0;
}

.empty-state {
  display: grid;
  justify-items: start;
  gap: 8px;
  padding: 22px;
  background: #ffffff;
  border: 1px dashed #c7dcde;
  border-radius: var(--radius);
}

.empty-state h2,
.empty-state p {
  margin: 0;
}

.empty-state p {
  color: var(--muted);
}

.alert {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(21, 39, 43, .05);
}

.alert-success {
  border-color: #b8dec8;
  background: #effaf3;
}

.alert-error {
  border-color: #edc0c0;
  background: #fff2f3;
}

.certificate-shell {
  overflow: auto;
  display: grid;
  justify-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(109, 76, 159, .09), rgba(122, 111, 240, .08)),
    #edf4f5;
  border-radius: var(--radius);
}

.certificate-print-stack {
  gap: 22px;
}

.certificate {
  position: relative;
  box-sizing: border-box;
  width: 1120px;
  height: 790px;
  min-height: 0;
  margin: 0 auto;
  padding: 0;
  background: #fffdf7;
  background-size: cover;
  background-position: center;
  border: 12px double var(--cert-border, #e8bd4a);
  color: #222;
  text-align: center;
  box-shadow: 0 28px 60px rgba(21, 39, 43, .12);
}

@media screen {
  .certificate {
    width: min(1120px, 100%);
    height: auto;
    min-height: 0;
    aspect-ratio: 1120 / 790;
  }

  .certificate.portrait {
    width: min(790px, 100%);
    height: auto;
    min-height: 0;
    aspect-ratio: 790 / 1120;
  }

  .certificate-logo {
    width: clamp(58px, 7.8vw, 92px);
    height: clamp(58px, 7.8vw, 92px);
    margin-bottom: clamp(6px, 1vw, 12px);
  }

  .certificate .school {
    font-size: clamp(18px, 2.7vw, 30px);
  }

  .certificate .title {
    margin: clamp(14px, 2.6vw, 28px) 0 10px;
    font-size: clamp(30px, 5.2vw, 58px);
  }

  .certificate .recipient {
    margin: clamp(14px, 2.8vw, 30px) auto clamp(12px, 2.2vw, 24px);
    font-size: clamp(24px, 4vw, 42px);
  }

  .certificate .body {
    font-size: clamp(15px, 2.2vw, 25px);
  }

  .certificate .footer-text {
    font-size: clamp(13px, 1.8vw, 20px);
  }

  .certificate .signer {
    margin-top: clamp(24px, 5vw, 62px);
  }
}

.certificate-logo {
  display: block;
  width: 92px;
  height: 92px;
  object-fit: contain;
  margin: 0 auto 12px;
}

.certificate.portrait {
  width: 790px;
  height: 1120px;
  min-height: 0;
}

.certificate .school {
  color: var(--cert-theme, #6d4c9f);
  font-size: 30px;
  font-weight: 750;
}

.certificate .title {
  margin: 28px 0 12px;
  color: var(--cert-theme, #6d4c9f);
  font-size: 58px;
  font-weight: 800;
}

.certificate .recipient {
  max-width: 760px;
  margin: 30px auto 24px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--cert-border, #e8bd4a);
  font-size: 42px;
  font-weight: 800;
}

.certificate .body {
  max-width: 860px;
  margin: 0 auto;
  font-size: 25px;
}

.certificate .footer-text {
  margin-top: 22px;
  color: #555;
  font-size: 20px;
}

.certificate .signer {
  display: grid;
  justify-content: center;
  gap: 5px;
  margin-top: 62px;
}

.signature-image {
  display: block;
  width: 190px;
  max-height: 80px;
  object-fit: contain;
  margin: -18px auto 0;
}

.certificate .signature-line {
  width: 300px;
  margin: 0 auto 6px;
  border-top: 1px solid #333;
}

.certificate .meta {
  position: absolute;
  bottom: 34px;
  left: 42px;
  color: #555;
  font-size: 16px;
  text-align: left;
}

.certificate .qr {
  position: absolute;
  right: 42px;
  bottom: 34px;
  color: #555;
  font-size: 13px;
  text-align: center;
}

.certificate .qr img {
  display: block;
  width: 126px;
  height: 126px;
  margin-bottom: 4px;
}

.certificate .cert-item {
  position: absolute;
  right: auto;
  bottom: auto;
  z-index: 1;
  margin: 0;
  line-height: 1.35;
}

.certificate .cert-logo {
  line-height: 1;
}

.certificate .cert-logo .certificate-logo {
  width: 100%;
  height: auto;
  max-height: 96px;
  margin: 0 auto;
}

.certificate .cert-item.school {
  font-weight: 750;
}

.certificate .cert-item.title {
  font-weight: 800;
}

.certificate .cert-item.recipient {
  max-width: none;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--cert-border, #e8bd4a);
  font-weight: 800;
}

.certificate .cert-item.body {
  max-width: none;
}

.certificate .cert-item.footer-text {
  color: #555;
}

.certificate .cert-item.signer {
  display: grid;
  gap: 5px;
  justify-content: stretch;
}

.certificate .cert-item.signer {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  align-items: end;
  column-gap: 18px;
}

.signer-person {
  display: grid;
  justify-items: center;
  gap: 5px;
  min-width: 0;
}

.signer-person .signature-line {
  width: min(100%, 180px);
}

.signer-person .signature-image {
  width: min(100%, 150px);
}

.signer-person strong,
.signer-person span {
  overflow-wrap: anywhere;
}

.certificate .cert-item.qr img {
  width: 100%;
  height: auto;
  margin: 0 auto 4px;
}

.favicon-preview {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 16px;
  background: #fbfaff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.favicon-preview img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  padding: 10px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.favicon-preview strong,
.favicon-preview p {
  margin: 0;
}

.favicon-preview p {
  color: var(--muted);
}

.verify-result {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 20px;
  align-items: center;
}

.report-row {
  display: grid;
  grid-template-columns: minmax(90px, .7fr) minmax(120px, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.report-row:last-child {
  border-bottom: 0;
}

.report-row span {
  color: var(--muted);
  font-weight: 700;
}

.report-bar {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8f3f4;
}

.report-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--violet));
}

.report-bar.coral i {
  background: linear-gradient(90deg, var(--coral), var(--gold));
}

.shortcut-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 16px 0;
}

.shortcut-card {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 8px;
  min-height: 126px;
  padding: 16px;
  color: var(--text);
  background: rgba(255, 255, 255, .9);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.shortcut-card:hover {
  color: var(--text);
  transform: translateY(-3px);
  border-color: rgba(109, 76, 159, .24);
  box-shadow: var(--shadow);
}

.shortcut-card .icon {
  width: 24px;
  height: 24px;
  color: var(--primary);
  filter: drop-shadow(0 6px 10px rgba(109, 76, 159, .16));
}

.shortcut-card strong {
  font-size: 16px;
}

.shortcut-card span {
  color: var(--muted);
  font-size: 13px;
}

.guide-panel {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
  padding: 16px;
  background: linear-gradient(135deg, rgba(109, 76, 159, .09), rgba(232, 189, 74, .11));
  border: 1px solid rgba(109, 76, 159, .16);
  border-radius: var(--radius);
  box-shadow: 0 12px 28px rgba(48, 31, 80, .08);
}

.guide-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(90deg, rgba(255, 255, 255, .42), transparent),
    linear-gradient(135deg, transparent 0 70%, rgba(55, 183, 215, .11) 70% 100%);
}

.guide-panel > * {
  position: relative;
  z-index: 1;
}

.guide-panel h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.guide-panel p {
  margin: 0;
  color: var(--muted);
}

.empty-state {
  display: grid;
  gap: 8px;
  place-items: center;
  padding: 28px 14px;
  color: var(--muted);
  text-align: center;
}

.empty-state .icon {
  width: 34px;
  height: 34px;
  color: var(--primary);
}

@media (max-width: 980px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .nav a {
    white-space: nowrap;
  }

  .nav-more {
    position: static;
  }

  .nav-menu {
    position: fixed;
    right: 12px;
    left: 12px;
    top: 104px;
  }

  .registry-card {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .event-card {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .event-card-actions {
    justify-content: flex-start;
    max-width: none;
  }

  .registry-actions {
    justify-content: flex-start;
    min-width: 0;
  }

  .home-hero,
  .home-preview,
  .home-activity-board {
    grid-template-columns: 1fr;
  }

  .home-hero {
    min-height: 0;
  }

  .home-feature-grid {
    grid-template-columns: 1fr;
  }

  .activity-card-grid {
    grid-template-columns: 1fr;
  }

  .public-result-card {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .public-result-actions {
    justify-content: flex-start;
    min-width: 0;
  }
}

@media (max-width: 860px) {
  .section-title,
  .footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero,
  .home-steps,
  .grid-2,
  .grid-3,
  .grid-4,
  .verify-result,
  .shortcut-grid,
  .guide-panel,
  .template-designer {
    grid-template-columns: 1fr;
  }

  .designer-controls {
    position: static;
  }

  .page {
    width: min(100% - 20px, 1180px);
    margin-top: 18px;
  }

  .panel {
    padding: 15px;
  }

  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  td,
  th {
    padding: 10px 11px;
  }

  .actions {
    align-items: stretch;
  }

  .registry-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .registry-meta {
    grid-template-columns: 1fr;
  }

  .registry-more {
    width: 100%;
  }

  .registry-more summary {
    width: 100%;
  }

  .registry-more-body {
    position: static;
    width: 100%;
    margin-top: 8px;
  }

  .home-stats {
    grid-template-columns: 1fr;
  }

  .activity-calendar {
    padding: 14px;
  }

  .activity-calendar h3 {
    font-size: 24px;
  }

  .calendar-cell {
    min-height: 68px;
    padding: 5px;
  }
}

@media (max-width: 520px) {
  .brand {
    min-width: 0;
  }

  .brand small {
    display: none;
  }

  .hero {
    padding: 20px;
  }

  .home-hero {
    padding: 22px;
  }

  .hero h1,
  .home-hero h1,
  .section-title h1 {
    font-size: 28px;
  }

  .certificate-mock {
    min-height: 310px;
    padding: 24px 18px;
  }

  .certificate-mock h2 {
    font-size: 32px;
  }

  .certificate-mock strong {
    font-size: 24px;
  }

  .btn,
  button,
  input[type="submit"] {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

@media print {
  html {
    width: 100%;
    height: 100%;
  }

  body {
    width: 100%;
    height: 100%;
    margin: 0 !important;
    background: #ffffff;
    overflow: hidden;
  }

  body::before,
  .loading-bar,
  .topbar,
  .footer,
  .no-print {
    display: none !important;
  }

  .page,
  .certificate-shell {
    width: 100%;
    height: 100%;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff;
    overflow: hidden;
  }

  .certificate {
    width: 297mm !important;
    height: 210mm !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border-width: 2.5mm !important;
    transform: none;
    box-shadow: none;
    overflow: hidden;
    page-break-inside: avoid;
    break-inside: avoid;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .certificate.portrait {
    width: 210mm !important;
    height: 297mm !important;
  }

  .signature-image {
    width: 42mm;
    max-height: 17mm;
    margin-top: -4mm;
  }

  .certificate .cert-item {
    right: auto !important;
    bottom: auto !important;
    margin: 0 !important;
  }

  .certificate .cert-item.qr img {
    width: 100% !important;
    height: auto !important;
  }

  @page {
    size: A4 landscape;
    margin: 0;
  }
}

@media print {
  body.print-batch-page {
    height: auto;
    overflow: visible;
  }

  body.print-batch-page .page,
  body.print-batch-page .certificate-shell {
    height: auto;
    overflow: visible;
  }

  body.print-batch-page .certificate-shell {
    display: block;
  }

  body.print-batch-page .certificate {
    page-break-after: always;
    break-after: page;
  }

  body.print-batch-page .certificate:last-child {
    page-break-after: auto;
    break-after: auto;
  }
}
