:root {
  --pink-50: #fffafc;
  --pink-100: #fff1f5;
  --pink-200: #ffd6e5;
  --pink-300: #f7a8c4;
  --pink-400: #ec6f9c;
  --pink-500: #db4b7e;
  --pink-600: #c2185b;
  --pink-700: #8f1a4a;
  --ink: #2f2430;
  --muted: #7d6570;
  --white: #ffffff;
  --surface: #ffffff;
  --surface-2: #fffbfe;
  --line: rgba(194, 24, 91, 0.10);
  --shadow: 0 10px 28px rgba(47, 36, 48, 0.05);
  --radius: 18px;
  --font: "Anuphan", "Noto Sans Thai", sans-serif;
  --text: 0.9375rem;       /* 15px — ขนาดมาตรฐาน UI */
  --text-sm: 0.8125rem;    /* 13px */
  --text-xs: 0.75rem;      /* 12px */
  --text-lg: 1.0625rem;    /* 17px */
  --h1: 1.375rem;          /* 22px */
  --h2: 1.125rem;          /* 18px */
  --h3: 1.0625rem;         /* 17px */
  --fw-normal: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  color-scheme: light;
}

[data-theme="dark"] {
  --pink-50: #2a1520;
  --pink-100: #3a1c2a;
  --pink-200: #5c2a40;
  --pink-300: #a8486e;
  --pink-400: #e05a8c;
  --pink-500: #f06292;
  --pink-600: #ec407a;
  --pink-700: #ff8fb3;
  --ink: #fce8f0;
  --muted: #c9a0ae;
  --white: #1a0f14;
  --surface: #24151c;
  --surface-2: #2e1a24;
  --line: rgba(255, 143, 179, 0.2);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--text);
  font-weight: var(--fw-normal);
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 92% -8%, rgba(255, 214, 229, 0.35), transparent 58%),
    radial-gradient(700px 360px at -5% 8%, rgba(255, 241, 245, 0.7), transparent 55%),
    linear-gradient(180deg, #ffffff 0%, #fffafc 48%, #ffffff 100%);
  min-height: 100vh;
  transition: background .25s ease, color .2s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-weight: var(--fw-bold);
  line-height: 1.35;
  letter-spacing: -0.01em;
}
h1 { font-size: var(--h1); }
h2 { font-size: var(--h2); }
h3, h4 { font-size: var(--h3); }
strong, b { font-weight: var(--fw-semibold); }
small { font-size: var(--text-sm); }

[data-theme="dark"] body {
  background:
    radial-gradient(1000px 520px at 90% -15%, rgba(236, 64, 122, 0.18), transparent 55%),
    radial-gradient(800px 480px at -5% 15%, rgba(156, 20, 73, 0.28), transparent 50%),
    linear-gradient(180deg, #140a0f 0%, var(--white) 40%, #1a0f14);
}

a { color: var(--pink-600); text-decoration: none; }
a:hover { color: var(--pink-700); }

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 100;
  background: var(--white);
  padding: .5rem .75rem;
  border-radius: 8px;
}

/* —— Landing · ขาวหลัก + ชมพู (มาตรฐาน clean) —— */
.lp-body {
  background: #ffffff;
  color: var(--ink);
}
.lp-wrap {
  width: min(1120px, calc(100% - 2.5rem));
  margin-inline: auto;
}

.lp-nav {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px) saturate(1.1);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.lp-nav.is-solid {
  border-bottom-color: rgba(233, 30, 99, 0.1);
  box-shadow: 0 8px 24px rgba(194, 24, 91, 0.05);
}
.lp-nav__bar {
  padding: .9rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.lp-brand {
  display: flex;
  align-items: center;
  gap: .7rem;
  color: inherit;
  min-width: 0;
}
.lp-brand:hover { color: inherit; }
.lp-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(145deg, var(--pink-400), var(--pink-600));
  box-shadow: 0 8px 18px rgba(233, 30, 99, 0.22);
  flex: 0 0 auto;
}
.lp-mark--sm {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  font-size: .9rem;
  box-shadow: none;
}
.lp-mark--img {
  display: block;
  object-fit: cover;
  padding: 0;
  background: #fff;
}
.lp-brand__text { display: grid; gap: .05rem; min-width: 0; }
.lp-brand strong {
  display: block;
  font-size: .95rem;
  font-weight: var(--fw-bold);
  line-height: 1.15;
}
.lp-brand small {
  color: var(--muted);
  font-size: var(--text-xs);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lp-nav__links {
  display: flex;
  align-items: center;
  gap: 1.1rem;
}
.lp-nav__links > a:not(.lp-btn) {
  color: var(--muted);
  font-weight: 600;
  font-size: .9rem;
}
.lp-nav__links > a:not(.lp-btn):hover { color: var(--pink-700); }

.lp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  border: 0;
  border-radius: 999px;
  padding: .72rem 1.25rem;
  font: inherit;
  font-size: .875rem;
  font-weight: var(--fw-semibold);
  cursor: pointer;
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, color .15s ease;
}
.lp-btn:active { transform: translateY(1px); }
.lp-btn .lp-ico { width: 1.05em; height: 1.05em; }
.lp-btn--solid {
  color: #fff;
  background: linear-gradient(145deg, var(--pink-400), var(--pink-600));
  box-shadow: 0 8px 20px rgba(194, 24, 91, 0.2);
}
.lp-btn--solid:hover { color: #fff; box-shadow: 0 12px 26px rgba(194, 24, 91, 0.26); }
.lp-btn--ghost {
  color: var(--pink-700);
  background: #fff;
  border: 1px solid rgba(233, 30, 99, 0.18);
}
.lp-btn--ghost:hover { background: var(--pink-50); color: var(--pink-700); }
.lp-btn--light {
  color: var(--pink-700);
  background: #fff;
  box-shadow: 0 10px 24px rgba(156, 20, 73, 0.18);
}
.lp-btn--light:hover { color: var(--pink-700); background: #fff7fa; }

.lp-hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(720px 380px at 92% 12%, rgba(255, 143, 179, 0.18), transparent 60%),
    radial-gradient(560px 320px at 0% 100%, rgba(255, 228, 238, 0.55), transparent 55%),
    #ffffff;
}
.lp-hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: clamp(2rem, 5vw, 3.5rem);
  align-items: center;
  padding: clamp(3.2rem, 8vh, 5.5rem) 0 clamp(3.5rem, 9vh, 5.75rem);
}
.lp-hero__copy { min-width: 0; animation: lpRise .75s ease both; }
.lp-hero__brand {
  margin: 0 0 .55rem;
  font-size: clamp(2.4rem, 6vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: .95;
  color: var(--pink-600);
}
.lp-hero__title {
  margin: 0 0 .85rem;
  font-size: clamp(1.55rem, 3.4vw, 2.15rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--ink);
  max-width: 12em;
}
.lp-hero__lead {
  margin: 0 0 1.5rem;
  max-width: 34rem;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.7;
}
.lp-cta {
  display: flex;
  flex-wrap: wrap;
  gap: .7rem;
  margin-bottom: 1.35rem;
}
.lp-hero__chips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.lp-hero__chips li {
  padding: .35rem .75rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
  color: var(--pink-700);
  background: rgba(233, 30, 99, 0.08);
  border: 1px solid rgba(233, 30, 99, 0.12);
}

.lp-hero__visual {
  position: relative;
  animation: lpRise .9s ease .08s both;
}
.lp-hero__frame {
  position: relative;
  border-radius: 28px;
  padding: 1.15rem;
  background:
    linear-gradient(160deg, #fff 0%, #fff5f8 55%, #ffe4ee 100%);
  border: 1px solid rgba(233, 30, 99, 0.12);
  box-shadow:
    0 24px 50px rgba(194, 24, 91, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.lp-hero__glow {
  position: absolute;
  inset: auto -8% -12% auto;
  width: 55%;
  height: 55%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 143, 179, 0.45), transparent 70%);
  filter: blur(8px);
  pointer-events: none;
}
.lp-dash-mock {
  position: relative;
  z-index: 1;
  display: grid;
  gap: .85rem;
  padding: 1rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(233, 30, 99, 0.1);
  box-shadow: 0 12px 28px rgba(194, 24, 91, 0.08);
}
.lp-dash-mock__bar {
  display: flex;
  gap: .35rem;
}
.lp-dash-mock__bar span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pink-200);
}
.lp-dash-mock__bar span:first-child { background: var(--pink-400); }
.lp-dash-mock__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .65rem;
}
.lp-dash-mock__stat {
  display: grid;
  gap: .3rem;
  padding: .75rem .8rem;
  border-radius: 14px;
  background: var(--pink-50);
  border: 1px solid rgba(233, 30, 99, 0.08);
}
.lp-dash-mock__stat em {
  font-style: normal;
  font-size: .72rem;
  color: var(--muted);
  font-weight: 600;
}
.lp-dash-mock__stat strong {
  font-size: 1.35rem;
  color: var(--pink-700);
  line-height: 1;
}
.lp-dash-mock__stat i {
  display: block;
  height: 5px;
  border-radius: 99px;
  background: rgba(233, 30, 99, 0.12);
  position: relative;
  overflow: hidden;
}
.lp-dash-mock__stat i::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--w, 50%);
  background: linear-gradient(90deg, var(--pink-400), var(--pink-600));
  border-radius: inherit;
}
.lp-dash-mock__list {
  display: grid;
  gap: .4rem;
}
.lp-dash-mock__list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .55rem .7rem;
  border-radius: 12px;
  background: #fff;
  border: 1px solid rgba(233, 30, 99, 0.08);
  font-size: .85rem;
}
.lp-dash-mock__list b { font-weight: 700; }
.lp-dash-mock__list span {
  color: var(--pink-600);
  font-weight: 600;
  font-size: .78rem;
}

.lp-kicker {
  margin: 0 0 .45rem;
  color: var(--pink-600);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.lp-kicker--on-pink { color: rgba(255, 247, 250, 0.85); }

.lp-band {
  padding: clamp(3.25rem, 7vw, 5rem) 0;
  background: #fff;
}
.lp-band--tint {
  background:
    linear-gradient(180deg, #fff8fa 0%, #ffffff 55%, #fff5f8 100%);
  border-block: 1px solid rgba(233, 30, 99, 0.08);
}
.lp-band__head {
  max-width: 36rem;
  margin-bottom: 2rem;
}
.lp-band__head--center {
  margin-inline: auto;
  text-align: center;
}
.lp-band__head h2 {
  margin: 0 0 .45rem;
  font-size: clamp(1.35rem, 2.6vw, 1.65rem);
  letter-spacing: -0.02em;
  line-height: 1.3;
}
.lp-band__head p {
  margin: 0;
  color: var(--muted);
  font-size: .975rem;
  line-height: 1.65;
}

.lp-feats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}
.lp-feats > li {
  display: grid;
  gap: .55rem;
  align-content: start;
  padding: 1.15rem 1.1rem;
  border-radius: 18px;
  background: #fff;
  border: 1px solid rgba(233, 30, 99, 0.1);
  box-shadow: 0 10px 28px rgba(194, 24, 91, 0.04);
  transition: transform .2s ease, box-shadow .2s ease;
}
.lp-feats > li:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 34px rgba(194, 24, 91, 0.08);
}
.lp-feats__ico {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--pink-700);
  background: rgba(233, 30, 99, 0.08);
}
.lp-feats__ico .lp-ico,
.lp-roles__ico .lp-ico,
.lp-ico { width: 1.15rem; height: 1.15rem; display: block; }
.lp-feats strong { font-size: .95rem; line-height: 1.35; }
.lp-feats p {
  margin: 0;
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.55;
}

.lp-roles {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}
.lp-roles > li {
  display: grid;
  gap: .45rem;
  align-content: start;
  padding: 1.25rem 1.2rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(233, 30, 99, 0.1);
  box-shadow: 0 12px 30px rgba(194, 24, 91, 0.05);
}
.lp-roles__ico {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin-bottom: .15rem;
  color: var(--pink-700);
  background: rgba(233, 30, 99, 0.1);
}
.lp-roles__label {
  color: var(--pink-600);
  font-size: .8rem;
  font-weight: 700;
}
.lp-roles strong { font-size: .975rem; line-height: 1.4; }
.lp-roles p {
  margin: 0;
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.55;
}

.lp-how { display: grid; gap: 1.75rem; }
.lp-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  counter-reset: none;
}
.lp-steps > li {
  display: grid;
  gap: .4rem;
  padding: 1.25rem 1.2rem;
  border-radius: 18px;
  background: #fff;
  border: 1px solid rgba(233, 30, 99, 0.1);
  position: relative;
}
.lp-steps__n {
  color: var(--pink-500);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .08em;
}
.lp-steps strong { font-size: .975rem; }
.lp-steps p {
  margin: 0;
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.55;
}

.lp-finale {
  padding: clamp(2.75rem, 6vw, 3.75rem) 0;
  background:
    linear-gradient(135deg, #e91e63 0%, #c2185b 48%, #9c1449 100%);
  color: #fff7fa;
}
.lp-finale__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.lp-finale h2 {
  margin: 0 0 .35rem;
  font-size: clamp(1.25rem, 2.4vw, 1.55rem);
  color: #fff;
}
.lp-finale p {
  margin: 0;
  color: rgba(255, 247, 250, 0.82);
  max-width: 36rem;
}

.lp-foot {
  background: #7a1038;
  color: rgba(255, 247, 250, 0.72);
  padding: 1.6rem 0;
  box-shadow: inset 0 3px 0 #ff8fb3;
  font-size: .875rem;
  line-height: 1.6;
}
.lp-foot__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem 2rem;
}
.lp-foot__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.lp-foot .lp-mark--sm {
  color: #fff7fa;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: none;
}
.lp-foot__copy { min-width: 0; }
.lp-foot__copy strong {
  display: block;
  color: #fff7fa;
  font-size: .9375rem;
  font-weight: 700;
  line-height: 1.35;
}
.lp-foot__copy p {
  margin: 2px 0 0;
  font-size: .8125rem;
  line-height: 1.45;
  color: rgba(255, 247, 250, 0.72);
}
.lp-foot__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .65rem;
  text-align: right;
  justify-self: end;
}
.lp-foot__meta p {
  margin: 0;
  font-size: .8125rem;
  color: rgba(255, 247, 250, 0.72);
  white-space: nowrap;
}
.lp-foot__badges {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  justify-content: flex-end;
}

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

@media (prefers-reduced-motion: reduce) {
  .lp-hero__copy,
  .lp-hero__visual { animation: none !important; }
}

@media (max-width: 980px) {
  .lp-feats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lp-hero__grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .lp-hero__visual { max-width: 460px; }
}

@media (max-width: 900px) {
  .lp-roles,
  .lp-steps { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .lp-nav__links > a:not(.lp-btn) { display: none; }
  .lp-wrap { width: calc(100% - 2rem); }
  .lp-feats { grid-template-columns: 1fr; }
  .lp-finale__inner { align-items: flex-start; }
  .lp-foot__row { grid-template-columns: 1fr; }
  .lp-foot__meta {
    width: 100%;
    align-items: flex-start;
    text-align: left;
  }
  .lp-foot__badges { justify-content: flex-start; }
  .lp-foot__meta p { white-space: normal; }
}

[data-theme="dark"] .lp-body { background: #140a0f; }
[data-theme="dark"] .lp-nav {
  background: rgba(20, 10, 15, 0.9);
  border-color: var(--line);
}
[data-theme="dark"] .lp-hero {
  background:
    radial-gradient(720px 380px at 92% 12%, rgba(236, 64, 122, 0.16), transparent 60%),
    #140a0f;
}
[data-theme="dark"] .lp-hero__brand { color: var(--pink-400); }
[data-theme="dark"] .lp-hero__frame,
[data-theme="dark"] .lp-dash-mock,
[data-theme="dark"] .lp-feats > li,
[data-theme="dark"] .lp-roles > li,
[data-theme="dark"] .lp-steps > li {
  background: var(--surface);
  border-color: var(--line);
}
[data-theme="dark"] .lp-dash-mock__stat,
[data-theme="dark"] .lp-band--tint {
  background: var(--surface-2);
}
[data-theme="dark"] .lp-band { background: #140a0f; }
[data-theme="dark"] .lp-btn--ghost {
  background: var(--surface);
  color: var(--pink-400);
}
[data-theme="dark"] .lp-foot { background: #4a0a24; }
/* App shell: sidebar + workspace */
.app-body { min-height: 100vh; }
.shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}
.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}
.app-main {
  flex: 1;
  width: min(1100px, 100%);
  margin: 0 auto;
  padding: 1.35rem 1.25rem 2rem;
}
.workspace {
  background: transparent;
}

/* Sidebar — deep wine / pink */
.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: .85rem;
  padding: 1rem .85rem 1rem;
  color: #fce8f0;
  background:
    radial-gradient(420px 240px at 0% 0%, rgba(236, 64, 122, 0.28), transparent 58%),
    linear-gradient(180deg, #3a0f22 0%, #2a0a18 48%, #1f0712 100%);
  border-right: 1px solid rgba(255, 182, 210, 0.14);
  box-shadow: inset 0 3px 0 rgba(244, 143, 177, 0.55);
  z-index: 40;
}
.sidebar__brand {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .5rem;
  padding: 0 .15rem;
}
.sidebar__logo {
  display: flex;
  align-items: center;
  gap: .7rem;
  color: inherit;
}
.sidebar__logo strong { display: block; font-size: 0.95rem; font-weight: var(--fw-bold); line-height: 1.2; color: #fff; }
.sidebar__logo small { color: rgba(252, 232, 240, 0.62); font-size: var(--text-xs); }
.sidebar__logo-img {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 14px;
  object-fit: cover;
  background: #fff;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.28);
}
.lp-mark--img {
  display: block;
  object-fit: cover;
  padding: 0;
  background: #fff;
}
.sidebar__close {
  display: none;
  border: 0;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  color: rgba(252, 232, 240, 0.72);
  cursor: pointer;
}
.sidebar__user {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .8rem .85rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 182, 210, 0.16);
}
.sidebar__avatar {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  font-weight: 700;
  color: #fff;
  background: rgba(236, 64, 122, 0.45);
  border: 1px solid rgba(255, 182, 210, 0.28);
}
.sidebar__user-text { min-width: 0; }
.sidebar__user-name {
  margin: 0;
  font-weight: var(--fw-semibold);
  font-size: 0.875rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar__user-role {
  margin: .15rem 0 0;
  color: rgba(252, 232, 240, 0.58);
  font-size: .78rem;
}
.sidebar__nav {
  flex: 1;
  overflow: auto;
  padding: .15rem .1rem .4rem;
  display: grid;
  gap: .85rem;
  scrollbar-width: thin;
}
.sidebar__section {
  padding: .55rem .45rem .5rem;
  border-radius: 16px;
  background: transparent;
  border: 1px solid transparent;
}
.sidebar__group {
  display: flex;
  align-items: center;
  gap: .45rem;
  margin: 0 .35rem .45rem;
  font-size: .68rem;
  font-weight: var(--fw-semibold);
  letter-spacing: .04em;
  text-transform: uppercase;
  color: rgba(252, 232, 240, 0.48);
}
.sidebar__group-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f48fb1;
}
.sidebar__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .25rem;
}
.sidebar__link {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .58rem .7rem;
  border-radius: 12px;
  color: rgba(252, 232, 240, 0.88);
  font-size: 0.875rem;
  font-weight: var(--fw-medium);
  text-decoration: none;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.sidebar__icon {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffc2d6;
  border: 1px solid rgba(255, 182, 210, 0.16);
}
.nav-icon { width: 18px; height: 18px; display: block; }
.sidebar__label { min-width: 0; line-height: 1.25; }
.sidebar__link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.sidebar__link:hover .sidebar__icon {
  background: rgba(236, 64, 122, 0.35);
  color: #fff;
  border-color: rgba(255, 182, 210, 0.28);
}
.sidebar__link.is-active {
  background: rgba(236, 64, 122, 0.32);
  color: #fff;
  box-shadow: inset 3px 0 0 #ffc2d6;
  font-weight: var(--fw-semibold);
}
.sidebar__link.is-active .sidebar__icon {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border-color: rgba(255, 182, 210, 0.32);
}
.sidebar__link--muted { color: rgba(252, 232, 240, 0.55); }
.sidebar__link--muted .sidebar__icon {
  background: rgba(255, 255, 255, 0.05);
  color: rgba(252, 232, 240, 0.55);
}
.sidebar__link--muted:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}
.sidebar__foot {
  padding-top: .55rem;
  border-top: 1px solid rgba(255, 182, 210, 0.14);
}

/* Top nav */
.nav-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 1.25rem;
  background: rgba(255,255,255,.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.nav-top__start { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.nav-top__context { min-width: 0; }
.nav-top__kicker {
  margin: 0;
  color: var(--muted);
  font-size: .8rem;
  font-weight: 600;
}
.nav-top__title {
  display: block;
  font-size: 1rem;
  font-weight: var(--fw-semibold);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-top__actions {
  display: flex;
  align-items: center;
  gap: .65rem;
  flex-shrink: 0;
}
.nav-top__status { flex-shrink: 0; }

/* System open/closed status */
.sys-status {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .35rem .7rem .35rem .55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  line-height: 1.2;
  white-space: nowrap;
  vertical-align: middle;
}
.sys-status__dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #c4b4ba;
  box-shadow: 0 0 0 3px rgba(196, 180, 186, 0.22);
}
.sys-status__label {
  font-weight: var(--fw-semibold);
  color: inherit;
}
.sys-status.is-open {
  color: var(--pink-700);
  background: var(--pink-50);
  border-color: var(--pink-200);
}
.sys-status.is-open .sys-status__dot {
  background: var(--pink-500);
  box-shadow: 0 0 0 3px rgba(219, 75, 126, 0.18);
  animation: sys-pulse 1.8s ease-in-out infinite;
}
.sys-status.is-closed {
  color: #7a5260;
  background: #faf7f8;
  border-color: var(--line);
}
.sys-status.is-closed .sys-status__dot {
  background: #b8a096;
  box-shadow: none;
}
.sys-status--lg {
  padding: .5rem .9rem .5rem .7rem;
  font-size: .9rem;
  gap: .55rem;
}
.sys-status--lg .sys-status__dot {
  width: 9px;
  height: 9px;
  flex-basis: 9px;
}
@keyframes sys-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(219, 75, 126, 0.16); }
  50% { box-shadow: 0 0 0 5px rgba(219, 75, 126, 0.08); }
}
@media (prefers-reduced-motion: reduce) {
  .sys-status.is-open .sys-status__dot { animation: none; }
}
[data-theme="dark"] .sys-status {
  background: var(--surface-2);
}
[data-theme="dark"] .sys-status.is-open {
  background: rgba(236, 64, 122, 0.14);
  border-color: rgba(255, 143, 179, 0.28);
  color: #ffc2d6;
}
[data-theme="dark"] .sys-status.is-closed {
  background: rgba(255,255,255,0.04);
  color: var(--muted);
}


/* Notification bell */
.notify { position: relative; }
.icon-btn {
  position: relative;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.icon-btn .nav-icon { width: 20px; height: 20px; color: var(--pink-600); }
.icon-btn:hover,
.icon-btn[aria-expanded="true"],
.notify.is-open .icon-btn {
  border-color: var(--pink-300);
  background: var(--pink-50);
  box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.1);
}
.notify-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--pink-600);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px #fff;
}
.notify-panel {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: min(340px, calc(100vw - 1.5rem));
  padding: .45rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(194, 24, 91, 0.14);
  z-index: 50;
}
.notify.is-open .notify-panel { display: grid; }
.notify-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .55rem .65rem .65rem;
  border-bottom: 1px solid var(--line);
}
.notify-head strong { font-size: .95rem; }
.notify-head a { font-size: .82rem; font-weight: var(--fw-semibold); }
.notify-empty {
  margin: 0;
  padding: 1.1rem .75rem;
  color: var(--muted);
  text-align: center;
  font-size: .9rem;
}
.notify-list {
  list-style: none;
  margin: 0;
  padding: .25rem 0 0;
  max-height: 320px;
  overflow: auto;
}
.notify-list li a {
  display: grid;
  gap: .2rem;
  padding: .7rem .7rem;
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
}
.notify-list li a:hover { background: var(--pink-50); }
.notify-list li.is-unread a { background: rgba(255, 228, 238, 0.45); }
.notify-list strong { font-size: .9rem; line-height: 1.35; }
.notify-list span {
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.notify-list time {
  color: #b07a8c;
  font-size: .75rem;
  font-weight: 600;
}
.notify-page-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .35rem;
}
.notify-page-list li a {
  display: grid;
  gap: .25rem;
  padding: .85rem .9rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}
.notify-page-list li a:hover { border-color: var(--pink-200); background: var(--pink-50); }
.notify-page-list li.is-unread a {
  border-color: var(--pink-200);
  background: rgba(255, 228, 238, 0.4);
}
.notify-page-list span { color: var(--muted); font-size: .92rem; }
.notify-page-list time { color: #b07a8c; font-size: .8rem; font-weight: 600; }

/* User dropdown */
.user-menu { position: relative; }
.top-user {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .28rem .55rem .28rem .28rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.top-user:hover,
.top-user[aria-expanded="true"],
.user-menu.is-open .top-user {
  border-color: var(--pink-300);
  box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.1);
}
.top-avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  object-fit: cover;
  font-weight: 700;
  font-size: .9rem;
  color: #fff;
  background: linear-gradient(145deg, var(--pink-400), var(--pink-600));
  box-shadow: 0 4px 10px rgba(233, 30, 99, 0.22);
}
.who { text-align: left; min-width: 0; }
.who strong,
.who span { display: block; }
.who strong {
  font-size: .875rem;
  line-height: 1.3;
  max-width: 9.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.who span {
  color: var(--muted);
  font-size: .75rem;
  line-height: 1.3;
  max-width: 9.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top-caret { flex: 0 0 auto; color: var(--muted); transition: transform .15s ease; }
.user-menu.is-open .top-caret { transform: rotate(180deg); }
.user-menu-panel {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  min-width: 240px;
  padding: .4rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(194, 24, 91, 0.14);
  z-index: 50;
}
.user-menu.is-open .user-menu-panel {
  display: grid;
}
.user-menu-head {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .55rem .65rem .7rem;
  margin-bottom: .2rem;
  border-bottom: 1px solid var(--line);
}
.user-menu-head .top-avatar { width: 40px; height: 40px; flex-basis: 40px; }
.user-menu-head .who strong,
.user-menu-head .who span { max-width: 11rem; }
.user-menu-label {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  min-width: 0;
}
.user-menu-panel .nav-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  color: var(--pink-600);
}
.user-menu-panel a {
  display: flex;
  align-items: center;
  gap: .75rem;
  width: 100%;
  padding: .7rem .75rem;
  border-radius: 12px;
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}
.user-menu-panel a:hover { background: var(--pink-50); color: var(--pink-700); }
.user-menu-panel b {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--pink-500);
  color: #fff;
  font-size: .72rem;
  line-height: 18px;
  text-align: center;
}
.user-menu-panel a.user-menu-logout { color: #9c1449; }
.user-menu-panel a.user-menu-logout .nav-icon { color: #9c1449; }
.user-menu-panel a.user-menu-logout:hover { background: #fff1f3; }
.user-menu-logout {
  margin-top: .2rem;
  border-top: 1px solid var(--line);
  border-radius: 0 0 12px 12px;
}

.profile-grid {
  display: grid;
  gap: .85rem;
  margin: 0;
}
.profile-grid > div {
  display: grid;
  gap: .2rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--line);
}
.profile-grid dt {
  margin: 0;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 600;
}
.profile-grid dd { margin: 0; font-weight: 600; }

.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  place-items: center;
}
.burger {
  display: grid;
  gap: 4px;
  width: 18px;
}
.burger span {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
}
.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  border: 0;
  background: rgba(40, 10, 22, 0.35);
  z-index: 35;
}

/* Footer (แบบ E-COACH · โทนชมพูเข้ม) */
.app-footer {
  margin-top: auto;
  padding: 18px 28px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px 28px;
  background: linear-gradient(135deg, #9c1449 0%, #7a1038 100%);
  color: rgba(255, 247, 250, 0.82);
  box-shadow: inset 0 3px 0 #ff8fb3;
  font-size: 0.875rem;
  line-height: 1.6;
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.brand-mark.sm {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  color: #fff7fa;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
}
img.brand-mark.sm,
.brand-mark.sm.school-mark--img {
  display: block;
  object-fit: cover;
  padding: 0;
  background: #fff;
  color: transparent;
}
.footer-copy { min-width: 0; }
.footer-copy strong {
  display: block;
  color: #fff7fa;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
}
.footer-copy p {
  margin: 2px 0 0;
  color: rgba(255, 247, 250, 0.72);
  font-size: 0.8125rem;
  line-height: 1.5;
}
.footer-meta {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: .65rem;
  text-align: right;
  justify-self: end;
}
.footer-meta p {
  margin: 0;
  color: rgba(255, 247, 250, 0.72);
  font-size: 0.8125rem;
  white-space: nowrap;
}
.footer-meta__badges {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  justify-content: flex-end;
}
.version-badge {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.35rem 0.55rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}
.version-badge__ver {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.version-badge__ver svg { width: 0.85rem; height: 0.85rem; flex: 0 0 auto; }
.version-badge__sep { opacity: 0.4; }
.version-badge__build { font-variant-numeric: tabular-nums; font-weight: 600; }
.version-badge--dark {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 247, 250, 0.86);
}
.version-badge--dark .version-badge__ver {
  background: rgba(255, 143, 179, 0.35);
  color: #ffe4ee;
}
.version-badge--light {
  background: #fff1f5;
  border: 1px solid #ffd0e0;
  color: #7a5260;
}
.version-badge--light .version-badge__ver {
  color: var(--pink-600);
  padding: 0;
  background: transparent;
}
.version-badge--light .version-badge__build { color: #b07a8c; }

.developer-badge {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.35rem 0.45rem;
  padding: 0.35rem 0.7rem 0.35rem 0.4rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}
.developer-badge__ico {
  width: 1.35rem;
  height: 1.35rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
}
.developer-badge__ico svg { width: 0.78rem; height: 0.78rem; }
.developer-badge__name { font-weight: var(--fw-semibold); }
.developer-badge--dark {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 247, 250, 0.78);
}
.developer-badge--dark .developer-badge__ico {
  background: rgba(255, 143, 179, 0.28);
  color: #ffe4ee;
}
.developer-badge--dark .developer-badge__label { color: rgba(255, 247, 250, 0.55); }
.developer-badge--dark .developer-badge__name { color: #fff7fa; }
.developer-badge--light {
  background: #fff1f5;
  border: 1px solid #ffd0e0;
  color: #7a5260;
}
.developer-badge--light .developer-badge__ico {
  background: rgba(233, 30, 99, 0.1);
  color: var(--pink-600);
}
.developer-badge--light .developer-badge__label { color: #b07a8c; }
.developer-badge--light .developer-badge__name { color: var(--pink-700); }

body.nav-open .nav-backdrop { display: block; }
body.nav-open .sidebar { transform: translateX(0); }

/* SweetAlert2 — โทน MoralDTW */
.swal2-popup {
  font-family: var(--font);
  border-radius: 18px !important;
}
.swal2-title { font-size: 1.25rem !important; color: var(--ink) !important; }
.swal2-html-container { color: var(--muted) !important; }
.mdtw-toast {
  border: 1px solid var(--line) !important;
  box-shadow: 0 14px 34px rgba(194, 24, 91, 0.14) !important;
}
.mdtw-confirm .swal2-confirm {
  border-radius: 999px !important;
  font-weight: 700 !important;
}
.mdtw-confirm .swal2-cancel {
  border-radius: 999px !important;
  font-weight: 600 !important;
}

.panel {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.panel h1, .panel h2 { margin-top: 0; font-weight: var(--fw-bold); }
.panel h1 { font-size: var(--h1); }
.panel h2 { font-size: var(--h2); }

/* —— Buttons (global) —— */
.btn,
a.btn,
label.btn,
button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  min-height: 42px;
  padding: .65rem 1.15rem;
  border-radius: 12px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 0.875rem;
  font-weight: var(--fw-semibold);
  line-height: 1.25;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  appearance: none;
  -webkit-appearance: none;
  transition: background .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .12s ease;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible {
  outline: 2px solid rgba(233, 30, 99, 0.35);
  outline-offset: 2px;
}
.btn:disabled,
.btn[disabled] {
  opacity: .55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.btn-primary,
a.btn-primary,
label.btn-primary,
button.btn-primary {
  color: #fff;
  background: linear-gradient(145deg, var(--pink-400), var(--pink-600));
  border-color: transparent;
  box-shadow: 0 8px 18px rgba(194, 24, 91, 0.2);
}
.btn-primary:hover,
a.btn-primary:hover,
label.btn-primary:hover {
  color: #fff;
  box-shadow: 0 12px 24px rgba(194, 24, 91, 0.28);
}
.btn-ghost,
a.btn-ghost,
label.btn-ghost,
button.btn-ghost {
  color: var(--pink-700);
  background: #fff;
  border-color: rgba(233, 30, 99, 0.18);
  box-shadow: 0 1px 0 rgba(59, 31, 43, 0.03);
}
.btn-ghost:hover,
a.btn-ghost:hover,
label.btn-ghost:hover {
  background: var(--pink-50);
  color: var(--pink-700);
  border-color: var(--pink-200);
}
.btn.danger,
.btn-ghost.danger,
button.danger,
a.danger {
  color: #9f1239;
}
.btn-ghost.danger:hover,
button.btn-ghost.danger:hover {
  background: #fff1f5;
  border-color: rgba(159, 18, 57, 0.28);
  color: #9f1239;
}
.btn-block { width: 100%; }
/* `.btn { display:… }` ทับ UA ของ [hidden] — บังคับซ่อนให้ชัด */
[hidden],
.btn[hidden],
button.btn[hidden],
a.btn[hidden],
label.btn[hidden] {
  display: none !important;
}

/* —— Standard cards (dashboard & modules) —— */
.md-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
  box-shadow: var(--shadow);
}
.md-card--hero {
  padding: 1.35rem 1.35rem 1.25rem;
  background:
    radial-gradient(640px 180px at 100% 0%, rgba(255, 214, 229, 0.45), transparent 58%),
    #ffffff;
  border-color: rgba(194, 24, 91, 0.08);
}
.md-kicker {
  margin: 0 0 .35rem;
  color: var(--pink-600);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.02em;
}
.dash { gap: 1.15rem; }
.dash-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.dash-hero__intro {
  display: flex;
  align-items: flex-start;
  gap: .85rem;
  min-width: 0;
  flex: 1 1 240px;
}
.dash-hero__logo {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 8px 18px rgba(194, 24, 91, 0.12);
}
.dash-hero__logo--fallback {
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--pink-700);
  background: var(--pink-50);
}
.dash-hero h1 { margin: 0 0 .3rem; font-size: clamp(1.2rem, 2.4vw, 1.4rem); font-weight: var(--fw-bold); }
.dash-hero .muted { margin: 0; }
.dash-hero__status {
  display: flex;
  align-items: center;
  gap: .65rem;
  flex-wrap: wrap;
}
.dash-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .9rem;
}
.dash-section-head h2 {
  margin: 0;
  font-size: var(--h2);
  font-weight: var(--fw-bold);
}
.dash-section-head a {
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .85rem;
}
.stat-card {
  display: grid;
  gap: .45rem;
  align-content: start;
}
.stat-card__label {
  margin: 0;
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
}
.stat-card {
  background: #ffffff;
  border-color: rgba(194, 24, 91, 0.08);
}
.stat-card__value {
  margin: 0;
  font-size: clamp(1.25rem, 2vw, 1.45rem);
  font-weight: var(--fw-bold);
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.stat-card__foot { margin: 0; font-size: .82rem; }
.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .75rem;
}
.action-card {
  display: flex;
  align-items: center;
  gap: .75rem;
  text-decoration: none;
  color: inherit;
  background: #ffffff;
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.action-card:hover {
  color: inherit;
  border-color: var(--pink-200);
  background: var(--pink-50);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(47, 36, 48, 0.06);
}
.action-card__icon {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--pink-50);
  color: var(--pink-600);
  border: 1px solid var(--line);
}
.action-card__icon .nav-icon { width: 22px; height: 22px; }
.action-card__body { min-width: 0; flex: 1; display: grid; gap: .15rem; }
.action-card__body strong { font-size: .95rem; }
.action-card__body small { color: var(--muted); font-size: .78rem; line-height: 1.35; }
.action-card__chev { color: var(--pink-400); font-weight: 700; }
.dash-split {
  display: grid;
  grid-template-columns: minmax(240px, 0.9fr) minmax(0, 1.1fr);
  gap: .85rem;
  align-items: start;
}
.phase-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .55rem;
}
.phase-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .7rem .8rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #ffffff;
}
.phase-item strong { display: block; margin-bottom: .15rem; }
.phase-item .muted { font-size: .78rem; }

.teacher-window {
  display: grid;
  gap: .95rem;
  background:
    radial-gradient(520px 160px at 0% 0%, rgba(236, 64, 122, 0.08), transparent 55%),
    var(--surface);
}
.teacher-window__msg {
  margin: .25rem 0 0;
  font-size: .88rem;
}
.teacher-window__empty {
  margin: 0;
  font-size: .85rem;
}
.teacher-window.is-closed {
  border-color: rgba(245, 158, 11, 0.35);
  background:
    radial-gradient(420px 120px at 0% 0%, rgba(245, 158, 11, 0.1), transparent 55%),
    var(--surface);
}
.htl {
  position: relative;
  padding: 1.1rem .35rem .35rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.htl__track {
  position: absolute;
  left: 1.4rem;
  right: 1.4rem;
  top: 1.55rem;
  height: 3px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.28);
  z-index: 0;
}
.htl__progress {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--pink-400, #f06292), var(--pink-600, #d81b60));
  transition: width .35s ease;
}
.htl__nodes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .5rem;
  min-width: max(100%, 36rem);
  position: relative;
  z-index: 1;
}
.htl__node {
  flex: 1 1 0;
  min-width: 7.5rem;
  display: grid;
  justify-items: center;
  text-align: center;
  gap: .35rem;
}
.htl__dot {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #cbd5e1;
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px rgba(148, 163, 184, 0.4);
}
.htl__title {
  font-size: .9rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
}
.htl__date {
  font-size: .75rem;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.3;
}
.htl__badge {
  display: inline-flex;
  align-items: center;
  padding: .15rem .5rem;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 700;
  color: var(--muted);
  background: rgba(148, 163, 184, 0.14);
}
.htl__node--done .htl__dot {
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
}
.htl__node--done .htl__badge {
  color: #047857;
  background: rgba(16, 185, 129, 0.12);
}
.htl__node--current .htl__dot,
.htl__node.is-now .htl__dot {
  background: var(--pink-500, #ec407a);
  box-shadow: 0 0 0 4px rgba(236, 64, 122, 0.18);
  animation: teacher-pulse 1.8s ease-in-out infinite;
}
.htl__node--current .htl__badge,
.htl__node.is-now .htl__badge {
  color: var(--pink-700, #ad1457);
  background: rgba(236, 64, 122, 0.12);
}
.htl__node--upcoming .htl__dot {
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.16);
}
.htl__node--upcoming .htl__badge {
  color: #b45309;
  background: rgba(245, 158, 11, 0.14);
}
.htl__node--muted .htl__title,
.htl__node--muted .htl__date {
  opacity: .72;
}
@keyframes teacher-pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(236, 64, 122, 0.16); }
  50% { box-shadow: 0 0 0 7px rgba(236, 64, 122, 0.08); }
}
.room-rail {
  list-style: none;
  margin: .65rem 0 .75rem;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 0;
}
.room-rail__step {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
}
.room-rail__step:last-child {
  flex: 0 0 auto;
}
.room-rail__node {
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  border: 1px solid var(--line);
  color: var(--muted);
  background: #fff;
  flex: 0 0 auto;
}
.room-rail__seg {
  flex: 1 1 auto;
  height: 2px;
  margin: 0 .2rem;
  background: rgba(148, 163, 184, 0.35);
  border-radius: 999px;
  min-width: .45rem;
}
.room-rail__step.is-done .room-rail__node {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
  color: #047857;
}
.room-rail__step.is-done .room-rail__seg {
  background: rgba(16, 185, 129, 0.45);
}
.room-rail__step.is-draft .room-rail__node {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
  color: #b45309;
}
.room-rail__step.is-current .room-rail__node {
  border-color: var(--pink-400, #f06292);
  color: var(--pink-700, #ad1457);
  box-shadow: 0 0 0 2px rgba(236, 64, 122, 0.12);
}
.phase-admin__status {
  margin: .65rem 0 0;
}
.phase-admin__form {
  margin-top: 1rem;
}
.phase-admin__actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem;
}
.phase-admin__list {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  gap: .65rem;
}
.phase-admin__item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .85rem .9rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.phase-admin__item-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .65rem;
  flex: 1;
  min-width: 0;
}
.phase-admin__item-main p {
  margin: .2rem 0 0;
  font-size: .8rem;
}
.phase-admin__item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  align-items: center;
}

.ws-window-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}
.ws-window-banner.is-closed {
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.08);
}
.ws-sequence-hint {
  margin: .65rem 0 0;
  font-size: .8rem;
}
.tabs .tab.is-locked {
  opacity: .55;
  cursor: not-allowed;
  pointer-events: none;
}
.tabs .tab.is-locked small {
  margin-left: .35rem;
  font-size: .7rem;
  font-weight: 600;
  color: var(--muted);
}
.tabs .tab.is-done::after {
  content: "✓";
  margin-left: .35rem;
  font-size: .75rem;
  color: #047857;
}
[data-theme="dark"] .phase-admin__item,
[data-theme="dark"] .room-rail__node {
  background: var(--surface);
}
[data-theme="dark"] .teacher-window.is-closed,
[data-theme="dark"] .ws-window-banner.is-closed {
  background: rgba(245, 158, 11, 0.12);
}
.grade-hint {
  margin: -.35rem 0 .75rem;
  font-size: .82rem;
}
.grade-accordion {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .65rem;
  align-items: start;
}
.grade-card,
.grade-fold {
  padding: 0;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #ffffff;
  overflow: hidden;
}
.grade-fold__summary {
  list-style: none;
  cursor: pointer;
  display: grid;
  gap: .4rem;
  padding: .75rem .8rem;
  user-select: none;
}
.grade-fold__summary::-webkit-details-marker { display: none; }
.grade-fold__top,
.grade-fold__mid {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
}
.grade-card__pct {
  margin: 0;
  font-size: 1.15rem;
  font-weight: var(--fw-bold);
  color: var(--ink);
  line-height: 1;
}
.grade-card__meta { margin: 0; font-size: .75rem; }
.grade-fold__chev {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--pink-50);
  position: relative;
  flex: 0 0 18px;
  transition: transform .2s ease, background .15s ease;
}
.grade-fold__chev::before {
  content: "";
  position: absolute;
  inset: 5px 5px 6px;
  border-right: 2px solid var(--pink-600);
  border-bottom: 2px solid var(--pink-600);
  transform: rotate(45deg);
  transition: transform .2s ease;
}
.grade-fold[open] {
  border-color: var(--pink-200);
  box-shadow: 0 8px 20px rgba(47, 36, 48, 0.05);
}
.grade-fold[open] .grade-fold__chev {
  background: var(--pink-100);
  transform: rotate(180deg);
}
.grade-fold[open] .grade-fold__summary {
  border-bottom: 1px solid var(--line);
  background: var(--pink-50);
}
.grade-fold__body {
  padding: .55rem .65rem .7rem;
  animation: rise .22s ease both;
}
.grade-room-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .4rem;
}
.grade-room-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .65rem;
  padding: .55rem .6rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #ffffff;
}
.grade-room-item.is-done {
  border-color: rgba(194, 24, 91, 0.16);
  background: var(--pink-50);
}
.grade-room-item__main {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: .25rem;
}
.grade-room-item__main strong {
  display: inline;
  margin-right: .35rem;
  font-size: .9rem;
}
.grade-room-item .progress-bar { margin-top: .1rem; }
.grade-room-item .muted { font-size: .75rem; }
.grade-room-item a {
  flex: 0 0 auto;
  font-size: .82rem;
  font-weight: var(--fw-semibold);
}
.room-progress-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: .65rem;
}
.room-card {
  padding: .85rem .9rem;
  display: grid;
  gap: .45rem;
  margin: 0;
  box-shadow: none;
}
.room-card.is-done {
  border-color: rgba(194, 24, 91, 0.16);
  background: var(--pink-50);
}
.room-card__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .4rem;
}
.room-card__meta { margin: 0; font-size: .78rem; }
.room-card__link {
  font-size: .82rem;
  font-weight: 700;
}

.teacher-room-panel {
  display: grid;
  gap: 1rem;
}
.teacher-room-list {
  display: grid;
  gap: 1rem;
}
.teacher-room {
  display: grid;
  gap: 1.1rem;
  padding: 1.15rem 1.2rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    radial-gradient(520px 160px at 100% 0%, rgba(236, 64, 122, 0.07), transparent 55%),
    #fff;
}
.teacher-room.is-done {
  border-color: rgba(16, 185, 129, 0.28);
  background:
    radial-gradient(420px 140px at 100% 0%, rgba(16, 185, 129, 0.1), transparent 55%),
    #fff;
}
.teacher-room__top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}
.teacher-room__identity .md-kicker {
  margin: 0 0 .2rem;
}
.teacher-room__name {
  margin: 0;
  font-size: clamp(1.55rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.teacher-room__meta {
  margin: .4rem 0 0;
  font-size: .9rem;
}
.teacher-room__score {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .65rem;
}
.teacher-room__pct {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--pink-700, #ad1457);
  line-height: 1;
}
.teacher-room__progress .progress-bar--lg {
  height: 10px;
  border-radius: 999px;
}
.teacher-room__steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .65rem;
}
.teacher-room__step-link {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .65rem;
  align-items: center;
  min-height: 4.4rem;
  padding: .75rem .8rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
  text-decoration: none;
  color: inherit;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.teacher-room__step-link:hover {
  border-color: var(--pink-200, #f8bbd0);
  background: var(--pink-50, #fff1f5);
  transform: translateY(-1px);
}
.teacher-room__step-no {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  font-weight: 700;
  border: 1px solid var(--line);
  color: var(--muted);
  background: #fff;
}
.teacher-room__step-body {
  display: grid;
  gap: .1rem;
  min-width: 0;
}
.teacher-room__step-body strong {
  font-size: .88rem;
  line-height: 1.2;
}
.teacher-room__step-body small,
.teacher-room__step-body em {
  font-size: .75rem;
  font-style: normal;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.teacher-room__step.is-done .teacher-room__step-no {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
  color: #047857;
}
.teacher-room__step.is-done .teacher-room__step-link {
  border-color: rgba(16, 185, 129, 0.22);
}
.teacher-room__step.is-draft .teacher-room__step-no {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
  color: #b45309;
}
.teacher-room__step.is-current .teacher-room__step-link {
  border-color: var(--pink-300, #f48fb1);
  box-shadow: 0 0 0 2px rgba(236, 64, 122, 0.1);
}
.teacher-room__step.is-current .teacher-room__step-no {
  border-color: var(--pink-400, #f06292);
  color: var(--pink-700, #ad1457);
  background: rgba(236, 64, 122, 0.08);
}
@media (max-width: 900px) {
  .teacher-room__steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 560px) {
  .teacher-room__steps {
    grid-template-columns: 1fr;
  }
  .teacher-room__top {
    align-items: flex-start;
  }
  .teacher-room__score {
    width: 100%;
  }
  .teacher-room__score .btn {
    flex: 1 1 auto;
    justify-content: center;
  }
}
[data-theme="dark"] .teacher-room,
[data-theme="dark"] .teacher-room.is-done {
  background: var(--surface);
}
[data-theme="dark"] .teacher-room__step-link,
[data-theme="dark"] .teacher-room__step-no {
  background: var(--surface-2);
}

/* Fast rooms ranking */
.speed-card {
  background: #ffffff;
}
.speed-empty {
  padding: .5rem 0 .15rem;
}
.speed-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .55rem;
}
.speed-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: .85rem;
  align-items: center;
  padding: .75rem .85rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #ffffff;
}
.speed-rank {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: .95rem;
  color: var(--pink-700);
  background: var(--pink-50);
  border: 1px solid var(--line);
}
.speed-item.is-gold .speed-rank {
  color: var(--pink-700);
  background: var(--pink-100);
  border-color: var(--pink-200);
}
.speed-item.is-silver .speed-rank {
  color: var(--muted);
  background: #f7f4f5;
  border-color: var(--line);
}
.speed-item.is-bronze .speed-rank {
  color: var(--pink-600);
  background: var(--pink-50);
  border-color: var(--pink-200);
}
.speed-item.is-gold {
  border-color: var(--pink-200);
  background: var(--pink-50);
}
.speed-item__title {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: .35rem;
}
.speed-item__meta { margin: .35rem 0 0; font-size: .78rem; }
.speed-item__btn { padding: .4rem .75rem; font-size: .85rem; }
@media (max-width: 640px) {
  .speed-item {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .speed-item__btn { grid-column: 2; justify-self: start; }
}

@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-split { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .stat-grid { grid-template-columns: 1fr; }
  .grade-accordion { grid-template-columns: 1fr; }
}

.form-grid { display: grid; gap: .9rem; }
.form-grid label { display: grid; gap: .35rem; font-weight: 600; }
.form-grid input, .form-grid select, .form-grid textarea {
  font: inherit;
  padding: .7rem .85rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
}
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus {
  outline: 2px solid rgba(233, 30, 99, 0.25);
  border-color: var(--pink-300);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1rem;
}
.tab {
  padding: .55rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.7);
  color: var(--muted);
  font-weight: 600;
}
.tab.active {
  color: var(--white);
  background: linear-gradient(145deg, var(--pink-400), var(--pink-600));
  border-color: transparent;
}
.tab-count {
  display: inline-block;
  margin-left: .25rem;
  font-size: .78rem;
  opacity: .85;
}
.tab.active .tab-count { opacity: 1; }

/* Budget catalog */
.budget-stats {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1.1rem;
  font-size: .9rem;
  color: var(--muted);
}
.budget-stats strong { color: var(--ink); font-size: 1.05rem; }
.budget-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}
.budget-form-panel h2,
.budget-list-panel h2 { margin: 0 0 .75rem; font-size: 1.15rem; }
.budget-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}
.budget-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  align-items: center;
}
.budget-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.budget-table th.num { text-align: right; }
.budget-note {
  display: block;
  font-size: .8rem;
  margin-top: .15rem;
  max-width: 28rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.budget-row-actions {
  display: flex;
  align-items: center;
  gap: .75rem;
  white-space: nowrap;
}
.budget-row-actions .link-danger,
.budget-row-actions button.link-danger {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: #9f1239;
  cursor: pointer;
}
.budget-row-actions button.link-danger:hover { text-decoration: underline; }
.budget-table tr.is-inactive td { opacity: .55; }
.table-wrap { overflow-x: auto; }

.budget-page .panel-head-row { align-items: flex-start; gap: 1rem; }
.budget-composer {
  border: 1px solid var(--pink-200);
  background:
    linear-gradient(180deg, rgba(255, 245, 248, 0.95), var(--surface) 40%);
  box-shadow: 0 10px 28px rgba(194, 24, 91, 0.08);
}
.budget-composer__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .75rem;
  margin-bottom: 1rem;
}
.budget-composer__head h2 { margin: 0 0 .25rem; font-size: var(--h2); }
.budget-composer__head p { margin: 0; }
.budget-composer__form {
  display: grid;
  gap: .9rem;
  max-width: 40rem;
}
.budget-composer__row {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: .75rem;
}
.budget-field {
  display: grid;
  gap: .35rem;
  font-weight: var(--fw-semibold);
  margin: 0;
  border: 0;
  padding: 0;
  min-width: 0;
}
.budget-field > span,
.budget-field > legend {
  font-size: var(--text-sm);
  color: var(--muted);
  font-weight: var(--fw-semibold);
  padding: 0;
}
.budget-field input,
.budget-field textarea,
.budget-field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .7rem .85rem;
  font: inherit;
  color: var(--ink);
  background: var(--white);
}
.budget-field input:focus,
.budget-field textarea:focus {
  outline: none;
  border-color: var(--pink-300);
  box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.12);
}
.budget-seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
}
.budget-seg__opt {
  position: relative;
  margin: 0;
  cursor: pointer;
}
.budget-seg__opt input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.budget-seg__opt span {
  display: block;
  text-align: center;
  padding: .65rem .75rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-weight: var(--fw-semibold);
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.budget-seg__opt input:checked + span {
  color: var(--pink-700);
  border-color: var(--pink-300);
  background: var(--pink-50);
  box-shadow: inset 0 0 0 1px rgba(233, 30, 99, 0.12);
}
.budget-seg__opt input:focus-visible + span {
  box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.18);
}
.budget-unit-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: -.35rem;
}
.budget-chip {
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--muted);
  border-radius: 999px;
  padding: .28rem .7rem;
  font: inherit;
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  cursor: pointer;
}
.budget-chip:hover { border-color: var(--pink-200); color: var(--pink-700); }
.budget-chip.is-active {
  background: var(--pink-100);
  border-color: var(--pink-300);
  color: var(--pink-700);
}
.budget-more {
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: .55rem .85rem;
  background: rgba(255, 255, 255, 0.45);
}
.budget-more summary {
  cursor: pointer;
  font-weight: var(--fw-semibold);
  color: var(--muted);
  list-style: none;
}
.budget-more summary::-webkit-details-marker { display: none; }
.budget-more__body {
  display: grid;
  gap: .85rem;
  margin-top: .85rem;
  padding-top: .85rem;
  border-top: 1px solid var(--line);
}
.budget-composer__actions {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  align-items: center;
  padding-top: .25rem;
}

.budget-catalog { padding-top: 1rem; }
.budget-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.budget-search {
  flex: 1 1 220px;
  margin: 0;
}
.budget-search input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .65rem 1rem;
  font: inherit;
  background: var(--surface-2);
  color: var(--ink);
}
.budget-search input:focus {
  outline: none;
  border-color: var(--pink-300);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.12);
}
.budget-filters {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.budget-filter {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem .8rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--muted);
  font-weight: var(--fw-semibold);
  font-size: var(--text-sm);
  text-decoration: none;
}
.budget-filter span {
  min-width: 1.25rem;
  padding: .05rem .35rem;
  border-radius: 999px;
  background: var(--surface-2);
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.budget-filter:hover { color: var(--pink-700); border-color: var(--pink-200); }
.budget-filter.is-active {
  color: var(--white);
  background: linear-gradient(145deg, var(--pink-400), var(--pink-600));
  border-color: transparent;
}
.budget-filter.is-active span {
  background: rgba(255, 255, 255, 0.22);
  color: var(--white);
}

.budget-cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .65rem;
}
.budget-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.budget-card:hover {
  border-color: var(--pink-200);
  box-shadow: 0 8px 22px rgba(194, 24, 91, 0.06);
}
.budget-card.is-inactive { opacity: .62; }
.budget-card.is-editing {
  border-color: var(--pink-300);
  box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.12);
}
.budget-card__main { min-width: 0; flex: 1; }
.budget-card__title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .45rem .55rem;
}
.budget-card__title {
  font-size: var(--text-lg);
  font-weight: var(--fw-bold);
  line-height: 1.3;
}
.budget-card__note {
  margin: .3rem 0 0;
  color: var(--muted);
  font-size: var(--text-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 36rem;
}
.budget-card__meta {
  margin: .45rem 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .35rem;
}
.budget-card__price {
  font-weight: var(--fw-bold);
  font-variant-numeric: tabular-nums;
  color: var(--pink-700);
  font-size: 1.05rem;
}
.budget-card__actions {
  display: flex;
  flex-shrink: 0;
  gap: .4rem;
  align-items: center;
}
.budget-card__btn {
  padding: .45rem .8rem;
  font-size: var(--text-sm);
}
.budget-card__btn--danger {
  color: #9f1239 !important;
}
.badge-off {
  background: #f3e8eb;
  color: #7a5260;
}
.budget-empty {
  text-align: center;
  display: grid;
  gap: .65rem;
  justify-items: center;
  padding: 2rem 1rem;
}
.budget-search-empty {
  margin: .85rem 0 0;
  text-align: center;
}

@media (max-width: 960px) {
  .budget-layout { grid-template-columns: 1fr; }
  .budget-form-row { grid-template-columns: 1fr; }
  .budget-composer__row { grid-template-columns: 1fr; }
  .budget-card {
    flex-direction: column;
    align-items: stretch;
  }
  .budget-card__actions {
    justify-content: stretch;
  }
  .budget-card__actions .btn,
  .budget-card__actions form { flex: 1; }
  .budget-card__actions .btn { width: 100%; justify-content: center; }
}

[data-theme="dark"] .budget-composer {
  background: linear-gradient(180deg, rgba(58, 28, 42, 0.85), var(--surface) 45%);
  border-color: var(--pink-200);
}
[data-theme="dark"] .budget-field input,
[data-theme="dark"] .budget-field textarea,
[data-theme="dark"] .budget-search input,
[data-theme="dark"] .budget-chip,
[data-theme="dark"] .budget-filter,
[data-theme="dark"] .budget-card {
  background: var(--surface-2);
}
[data-theme="dark"] .budget-seg__opt span { background: var(--surface); }
[data-theme="dark"] .badge-off { background: rgba(255, 143, 179, 0.12); color: var(--muted); }
[data-theme="dark"] .budget-card__btn--danger { color: #fb7185 !important; }

.budget-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: 1rem;
  padding-top: .85rem;
  border-top: 1px solid var(--line);
}
.budget-subnav__link {
  padding: .45rem .9rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.65);
  color: var(--muted);
  font-weight: 600;
  font-size: .9rem;
  text-decoration: none;
}
.budget-subnav__link:hover { color: var(--pink-700); border-color: var(--pink-200); }
.budget-subnav__link.is-active {
  color: var(--white);
  background: linear-gradient(145deg, var(--pink-400), var(--pink-600));
  border-color: transparent;
}
.budget-mode {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: .75rem;
}
.budget-mode__option {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  padding: .9rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--pink-50);
  cursor: pointer;
}
.budget-mode__option.is-active {
  border-color: var(--pink-300);
  box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.1);
  background: rgba(233, 30, 99, 0.08);
}
.budget-mode__option input { margin-top: .2rem; accent-color: var(--pink-600); }
.budget-mode__option strong { display: block; font-size: .95rem; }
.budget-mode__option small { display: block; margin-top: .2rem; color: var(--muted); line-height: 1.4; }
.budget-grade-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .85rem;
}
.budget-grade-card {
  display: grid;
  gap: .55rem;
  padding: .85rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.55);
}
.budget-grade-card h3 { margin: 0; font-size: 1.1rem; }
.budget-grade-card label,
.budget-room-field {
  display: grid;
  gap: .3rem;
  font-size: .85rem;
  font-weight: 600;
}
.budget-grade-card input,
.budget-room-field input {
  font: inherit;
  font-weight: 500;
  padding: .55rem .7rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
}
.budget-live-total { margin: 0; font-weight: 700; color: var(--pink-700); }
.budget-alloc-panel[hidden] { display: none !important; }
.budget-room-tabs {
  margin: .35rem 0 1rem;
  gap: .4rem;
}
.budget-room-tab {
  min-width: 4.5rem;
  border-radius: 14px;
  cursor: pointer;
  font: inherit;
}
.budget-room-pane { display: grid; gap: .85rem; }
.budget-room-pane[hidden] { display: none !important; }
.budget-room-pane__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem .85rem;
}
.budget-room-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
}
.budget-room-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 320px;
}
.budget-room-table th,
.budget-room-table td {
  padding: .85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.budget-room-table th {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  background: #fffafc;
}
.budget-room-table tr:last-child td { border-bottom: 0; }
.budget-room-table th:last-child,
.budget-room-table td:last-child {
  width: min(280px, 48%);
}
.budget-room-input {
  width: 100%;
  max-width: 220px;
  font: inherit;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: .65rem .8rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}
.budget-room-input:focus {
  outline: 2px solid rgba(233, 30, 99, 0.25);
  border-color: var(--pink-300);
}
[data-theme="dark"] .budget-subnav__link { background: rgba(36, 21, 28, 0.7); }
[data-theme="dark"] .budget-grade-card,
[data-theme="dark"] .budget-mode__option { background: var(--surface-2); }
[data-theme="dark"] .budget-grade-card input,
[data-theme="dark"] .budget-room-input { background: var(--surface); color: var(--ink); }
[data-theme="dark"] .budget-room-table th { background: var(--surface-2); }

/* —— School logo (settings) —— */
.org-logo-panel { scroll-margin-top: 5rem; }
.org-logo {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 1rem 1.25rem;
  align-items: center;
}
.org-logo-preview {
  width: 88px;
  height: 88px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.95), transparent 55%),
    var(--pink-50);
  box-shadow: 0 10px 24px rgba(194, 24, 91, 0.1);
}
.org-logo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.org-logo-preview span {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--pink-600);
}
.org-logo-copy .settings-h2 { margin: 0; }
.org-logo-desc {
  margin: .35rem 0 .9rem;
  max-width: 40rem;
  line-height: 1.5;
}
.org-logo-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .65rem;
}
.org-logo-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .65rem;
}
.org-logo-delete { margin: 0; }
.org-logo-filename {
  font-size: .85rem;
}
.logo-crop-dialog {
  width: min(520px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  margin: auto;
  border: 0;
  padding: 0;
  border-radius: 20px;
  background: transparent;
  color: inherit;
  box-shadow: 0 28px 80px rgba(59, 31, 43, 0.28);
}
.logo-crop-dialog::backdrop {
  background: rgba(59, 31, 43, 0.48);
  backdrop-filter: blur(2px);
}
.logo-crop-panel {
  display: grid;
  background: var(--surface);
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.logo-crop-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 12px;
}
.logo-crop-header h2 { margin: 0 0 4px; font-size: 1.05rem; }
.logo-crop-header .muted { margin: 0; font-size: .85rem; }
.logo-crop-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.logo-crop-close:hover { background: var(--pink-50); color: var(--pink-700); }
.logo-crop-stage {
  position: relative;
  width: min(100%, 420px);
  aspect-ratio: 1;
  margin: 0 auto;
  overflow: hidden;
  background: #2a1520;
  touch-action: none;
  cursor: grab;
  user-select: none;
}
.logo-crop-stage.is-dragging { cursor: grabbing; }
.logo-crop-stage img {
  position: absolute;
  top: 50%;
  left: 50%;
  max-width: none;
  transform-origin: center center;
  pointer-events: none;
  will-change: transform;
}
.logo-crop-frame {
  position: absolute;
  inset: 10%;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 24px;
  box-shadow: 0 0 0 999px rgba(26, 12, 18, 0.45);
  pointer-events: none;
}
.logo-crop-controls { padding: 14px 18px 0; display: grid; gap: 8px; }
.logo-crop-zoom {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  font-size: .82rem;
  color: var(--muted);
}
.logo-crop-zoom input[type="range"] { width: 100%; accent-color: var(--pink-500); }
.logo-crop-hint { margin: 0; }
.logo-crop-hint.is-error { color: #9f1239; }
.logo-crop-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 18px 18px;
}
@media (max-width: 640px) {
  .org-logo { grid-template-columns: 1fr; }
  .org-logo-actions { width: 100%; }
}

/* —— School virtues (settings chips) —— */
.settings-hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: .5rem 0;
}
.settings-h2 {
  margin: 0;
  font-size: 1.1rem;
}
.virtue-panel { scroll-margin-top: 5rem; }
.virtue-form { display: grid; gap: 1rem; margin-top: .85rem; }
.virtue-card {
  display: grid;
  gap: .85rem;
  padding: 1rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background:
    radial-gradient(520px 180px at 100% 0%, rgba(255, 143, 179, 0.18), transparent 55%),
    rgba(255, 255, 255, 0.72);
}
[data-theme="dark"] .virtue-card { background: var(--surface-2); }
.virtue-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  min-height: 2.6rem;
  align-items: flex-start;
}
.virtue-empty { margin: 0; width: 100%; }
.virtue-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  max-width: 100%;
  padding: .42rem .4rem .42rem .85rem;
  border-radius: 999px;
  border: 1px solid var(--pink-200);
  background: linear-gradient(145deg, rgba(255, 228, 238, 0.95), rgba(255, 255, 255, 0.95));
  color: var(--pink-700);
  font-weight: 700;
  font-size: .9rem;
  line-height: 1.25;
  box-shadow: 0 4px 12px rgba(194, 24, 91, 0.08);
  animation: rise .28s ease both;
}
[data-theme="dark"] .virtue-chip {
  background: rgba(236, 64, 122, 0.16);
  border-color: rgba(255, 143, 179, 0.28);
  color: #ffc2d6;
}
.virtue-chip__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 16rem;
}
.virtue-chip__x {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border: 0;
  border-radius: 999px;
  background: rgba(194, 24, 91, 0.1);
  color: var(--pink-700);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.virtue-chip__x:hover {
  background: rgba(159, 18, 57, 0.18);
  color: #9f1239;
}
.virtue-compose {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .55rem;
}
.virtue-compose input {
  font: inherit;
  padding: .7rem .9rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
}
.virtue-compose input:focus {
  outline: 2px solid rgba(233, 30, 99, 0.25);
  border-color: var(--pink-300);
}
.virtue-hint { margin: 0; font-size: .82rem; }
.virtue-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  align-items: center;
}
.sso-connect-panel { scroll-margin-top: 5rem; }
.sso-status {
  display: flex;
  align-items: center;
  gap: .85rem;
  flex-wrap: wrap;
  margin: 1rem 0;
  padding: .9rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
}
.sso-status.is-on { border-color: rgba(46, 125, 50, 0.35); background: rgba(232, 245, 233, 0.55); }
.sso-status.is-off { border-color: rgba(245, 158, 11, 0.35); background: rgba(255, 248, 225, 0.55); }
.sso-status__dot {
  width: 12px; height: 12px; border-radius: 50%; flex: 0 0 12px;
  background: #f59e0b;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.18);
}
.sso-status.is-on .sso-status__dot {
  background: #2e7d32;
  box-shadow: 0 0 0 4px rgba(46, 125, 50, 0.18);
}
.sso-status__text { flex: 1; min-width: 12rem; display: grid; gap: .15rem; }
.sso-status__text strong { font-size: .95rem; }
.sso-token-mask {
  font-size: .78rem;
  padding: .35rem .55rem;
  border-radius: 8px;
  background: rgba(59, 31, 43, 0.06);
  color: var(--muted);
}
.sso-connect-form { margin-top: .25rem; }
.sso-connect-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  align-items: center;
}
[data-theme="dark"] .sso-status { background: var(--surface-2); }
[data-theme="dark"] .sso-status.is-on { background: rgba(46, 125, 50, 0.16); }
[data-theme="dark"] .sso-status.is-off { background: rgba(245, 158, 11, 0.12); }

.sso-admin-list {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  gap: .55rem;
}
.sso-admin-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: .75rem;
  align-items: center;
  padding: .65rem .75rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
}
.sso-admin-item strong { display: block; }
.sso-admin-item small { display: block; margin-top: .1rem; font-size: .8rem; }
[data-theme="dark"] .sso-admin-item { background: var(--surface-2); }
@media (max-width: 640px) {
  .virtue-compose { grid-template-columns: 1fr; }
}

/* —— Unified HTTP error pages —— */
.error-body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.error-shell {
  width: min(520px, 100%);
  display: grid;
  gap: 1.1rem;
  justify-items: stretch;
  animation: rise .45s ease both;
}
.error-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: inherit;
  text-decoration: none;
  justify-self: start;
}
.error-brand:hover { color: inherit; }
.error-brand__mark {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(145deg, var(--pink-400), var(--pink-600));
  box-shadow: 0 10px 24px rgba(194, 24, 91, 0.25);
}
img.error-brand__mark,
.error-brand__mark.school-mark--img {
  display: block;
  object-fit: cover;
  padding: 0;
  background: #fff;
  color: transparent;
  box-shadow: 0 8px 18px rgba(194, 24, 91, 0.18);
}
.error-brand strong { display: block; font-size: 1.05rem; line-height: 1.2; }
.error-brand small { color: var(--muted); font-size: .8rem; }
.error-card {
  position: relative;
  overflow: hidden;
  padding: 1.6rem 1.4rem 1.35rem;
  border-radius: calc(var(--radius) + 4px);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}
[data-theme="dark"] .error-card { background: rgba(36, 21, 28, 0.92); }
.error-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: linear-gradient(180deg, var(--pink-300), var(--pink-600));
}
.error-card--warn::before { background: linear-gradient(180deg, #fbbf24, #d97706); }
.error-card--danger::before { background: linear-gradient(180deg, #fb7185, #9f1239); }
.error-code {
  margin: 0 0 .35rem;
  font-size: clamp(2.25rem, 7vw, 3.15rem);
  font-weight: var(--fw-bold);
  line-height: 1;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, var(--pink-400), var(--pink-700));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.error-card h1 {
  margin: 0 0 .55rem;
  font-size: clamp(1.15rem, 2.5vw, 1.4rem);
  line-height: 1.3;
}
.error-message {
  margin: 0 0 .45rem;
  font-size: var(--text);
  line-height: 1.55;
  color: var(--ink);
}
.error-detail {
  margin: 0 0 1.15rem;
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.55;
}
.error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
}
.error-foot {
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: .8rem;
}
.error-debug {
  margin: 0 0 1rem;
  padding: .75rem .85rem;
  border-radius: 12px;
  background: rgba(159, 18, 57, 0.08);
  border: 1px solid rgba(159, 18, 57, 0.2);
  color: var(--pink-700);
  font-size: .78rem;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 160px;
  overflow: auto;
}

.progress-bar {
  height: 10px;
  border-radius: 999px;
  background: var(--pink-100);
  overflow: hidden;
}
.progress-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--pink-300), var(--pink-500));
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .95rem;
}
.table th, .table td {
  text-align: left;
  padding: .65rem .5rem;
  border-bottom: 1px solid var(--line);
}
.badge {
  display: inline-block;
  padding: .15rem .55rem;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 700;
  background: var(--pink-100);
  color: var(--pink-700);
}
.badge-ok { background: var(--pink-50); color: var(--pink-700); border: 1px solid var(--pink-200); }
.badge-draft { background: #faf7f8; color: var(--muted); border: 1px solid var(--line); }

.muted { color: var(--muted); }
.stack { display: grid; gap: 1rem; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
.panel-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.panel-head-row h1 { margin: 0 0 .35rem; }
.inline-form { margin: 0; }
.committee-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.committee-card { margin: 0; }
.committee-card__head {
  display: grid;
  gap: .65rem;
  margin-bottom: .75rem;
}
.committee-card__head h2 { margin: 0; font-size: 1.25rem; }
.committee-count { margin: .15rem 0 0; font-size: .85rem; font-weight: 600; }
.committee-search input {
  width: 100%;
  font: inherit;
  padding: .55rem .75rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
}
.committee-search input:focus {
  outline: 2px solid rgba(233, 30, 99, 0.25);
  border-color: var(--pink-300);
}
.committee-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .35rem;
  max-height: 280px;
  overflow: auto;
}
.committee-option {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .45rem .5rem;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
}
.committee-option:hover { background: var(--pink-50); }
.committee-option:has(input:checked) {
  background: rgba(233, 30, 99, 0.1);
  border-color: var(--pink-200);
}
.committee-option input { width: 16px; height: 16px; accent-color: var(--pink-600); flex: 0 0 auto; }
.committee-option__avatar {
  width: 34px; height: 34px; flex: 0 0 34px;
  border-radius: 50%;
  display: grid; place-items: center;
  overflow: hidden;
  font-weight: 700; font-size: .85rem;
  color: #fff;
  background: linear-gradient(145deg, var(--pink-400), var(--pink-600));
}
.committee-option__avatar img { width: 100%; height: 100%; object-fit: cover; }
.committee-option__text { min-width: 0; display: grid; gap: .1rem; }
.committee-option__text strong {
  font-size: .9rem; line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.committee-option__text small {
  color: var(--muted); font-size: .75rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.committee-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.committee-actions .muted { margin: 0; }
.auth-wrap {
  min-height: calc(100vh - 2rem);
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.auth-card { width: min(420px, 100%); }

.placeholder-box {
  border: 2px dashed var(--pink-200);
  border-radius: var(--radius);
  padding: 2rem 1.25rem;
  text-align: center;
  color: var(--muted);
  background: rgba(255,245,248,.6);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
@keyframes drift {
  from { transform: scale(1) translate3d(0,0,0); }
  to { transform: scale(1.04) translate3d(-1.5%, 1%, 0); }
}

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(280px, 86vw);
    transform: translateX(-105%);
    transition: transform .2s ease;
    box-shadow: 12px 0 40px rgba(20, 4, 10, 0.45);
  }
  .sidebar__close { display: inline-grid; place-items: center; }
  .nav-toggle { display: grid; }
  .workspace { min-height: 100vh; }
}

@media (max-width: 640px) {
  .nav-top { padding: .75rem 1rem; }
  .top-user .who { display: none; }
  .nav-top__status .sys-status__label { display: none; }
  .nav-top__status.sys-status {
    padding: .4rem;
    gap: 0;
  }
  .app-main { padding: 1.1rem 1rem 1.75rem; }
  .app-footer {
    grid-template-columns: 1fr;
    align-items: start;
    padding-left: 16px;
    padding-right: 16px;
  }
  .footer-meta {
    width: 100%;
    align-items: flex-start;
    text-align: left;
  }
  .footer-meta__badges { justify-content: flex-start; }
  .footer-meta p { white-space: normal; }
}

/* —— Login gate (แบบ E-COACH · โทนชมพู) —— */
.auth-body.is-login { background: #fff5f8; }
.gate {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(460px, 1.15fr) minmax(400px, 0.85fr);
}
.gate-story {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
  padding: 52px 64px 48px;
  color: #fff7fa;
  background:
    radial-gradient(680px 380px at 0% 0%, rgba(255, 143, 179, 0.45), transparent 58%),
    radial-gradient(420px 280px at 100% 100%, rgba(92, 12, 48, 0.55), transparent 62%),
    linear-gradient(158deg, #f75a8f 0%, #c2185b 46%, #7a1038 100%);
  box-shadow: inset 0 3px 0 #ffb3cd;
}
.gate-story::before,
.gate-story::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  pointer-events: none;
  z-index: -1;
}
.gate-story::before { width: 540px; height: 540px; right: -190px; top: -160px; }
.gate-story::after { width: 280px; height: 280px; left: -90px; bottom: 18%; }
.gate-watermark {
  position: absolute;
  right: -0.04em;
  bottom: -0.18em;
  z-index: -1;
  margin: 0;
  font-size: clamp(8rem, 18vw, 16rem);
  font-weight: 700;
  line-height: 0.8;
  letter-spacing: -0.06em;
  color: rgba(255, 255, 255, 0.06);
  user-select: none;
  pointer-events: none;
}
.gate-brand { display: flex; align-items: center; gap: 14px; }
.gate-mark {
  width: 52px; height: 52px; flex: 0 0 52px; display: grid; place-items: center;
  border-radius: 16px; font-weight: 700;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.24);
  box-shadow: inset 0 -2px 0 rgba(255, 179, 205, 0.75);
  overflow: hidden;
}
img.gate-mark,
.gate-mark.school-mark--img {
  display: block;
  object-fit: cover;
  padding: 0;
  background: #fff;
  color: transparent;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}
.gate-brand strong, .gate-brand span { display: block; }
.gate-brand strong { font-size: 1.0625rem; letter-spacing: 0.04em; }
.gate-brand span { color: rgba(255, 247, 250, 0.8); font-size: 0.875rem; }
.gate-copy h1 {
  max-width: 12em;
  margin: 0 0 14px;
  font-size: clamp(1.55rem, 2.6vw, 2rem);
  font-weight: var(--fw-bold);
  line-height: 1.3;
}
.gate-lead {
  max-width: 28em;
  margin: 0;
  color: rgba(255, 247, 250, 0.86);
  font-size: 0.95rem;
  line-height: 1.6;
}
.gate-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; max-width: 420px; }
.gate-steps li {
  position: relative;
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 14px;
  align-items: start;
  padding-bottom: 20px;
}
.gate-steps li:last-child { padding-bottom: 0; }
.gate-steps li:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 21px;
  top: 46px;
  bottom: 2px;
  width: 1px;
  background: rgba(255, 255, 255, 0.28);
}
.step-mark {
  width: 44px; height: 44px; display: grid; place-items: center;
  border-radius: 14px; font-weight: 700;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
}
.gate-steps strong { display: block; font-size: 1rem; line-height: 1.35; }
.gate-steps small { display: block; margin-top: 2px; color: rgba(255, 247, 250, 0.74); font-size: 0.875rem; }
.gate-panel {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 36px 48px 24px;
  background:
    radial-gradient(420px 220px at 100% 0%, rgba(233, 30, 99, 0.07), transparent 70%),
    #fff5f8;
}
.gate-form { width: min(400px, 100%); margin: auto; }
.gate-intro .kicker {
  margin: 0 0 8px;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--pink-600);
}
.gate-form h2 { margin: 0 0 6px; font-size: 1.45rem; font-weight: var(--fw-bold); line-height: 1.3; color: var(--ink); }
.gate-intro .lede { margin: 0 0 28px; font-size: 0.975rem; line-height: 1.55; color: var(--muted); }
.login-alert {
  display: flex; align-items: flex-start; gap: 10px;
  margin: 0 0 18px; padding: 12px 14px; border-radius: 14px;
  border: 1px solid #fecdd3; background: #fff1f2; color: var(--pink-700);
}
.login-alert p { margin: 0; font-size: 0.9375rem; line-height: 1.5; }
.login-alert svg { width: 20px; height: 20px; flex: 0 0 20px; margin-top: 2px; }
.login-form { display: grid; gap: 18px; }
.gate-form .field { display: grid; gap: .4rem; }
.gate-form .field label { font-size: 0.875rem; font-weight: 600; color: var(--ink); }
.login-control { position: relative; }
.login-glyph {
  position: absolute; left: 14px; top: 50%; width: 18px; height: 18px;
  transform: translateY(-50%); color: #b07a8c; pointer-events: none;
}
.gate-form .field input {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px 12px 44px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  font: inherit;
  color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.gate-form .field input:focus {
  outline: none;
  border-color: var(--pink-400);
  box-shadow: 0 0 0 4px rgba(233, 30, 99, 0.14);
}
.gate-form .field input[aria-invalid="true"] {
  border-color: #e11d48;
  box-shadow: 0 0 0 4px rgba(225, 29, 72, 0.12);
}
.login-secret input { padding-right: 48px; }
.login-secret .reveal {
  position: absolute;
  top: 1px;
  right: 1px;
  bottom: 1px;
  width: 46px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: #b07a8c;
  border-radius: 0 13px 13px 0;
  padding: 0;
  cursor: pointer;
}
.login-secret .reveal svg { width: 20px; height: 20px; display: block; }
.login-secret .reveal .eye-shut,
.login-secret .reveal.is-open .eye-open { display: none; }
.login-secret .reveal.is-open .eye-shut { display: block; }
.login-secret .reveal:hover,
.login-secret .reveal:focus-visible { color: var(--pink-600); background: transparent; }
.login-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.login-label-row label { margin: 0; }
.login-remember {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  margin: -.25rem 0 0;
  font-size: .875rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.login-remember input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--pink-600);
  cursor: pointer;
}
.login-remember span { line-height: 1.3; }
.login-forgot { font-size: 0.8125rem; font-weight: 600; text-decoration: none; color: var(--pink-600); }
.login-forgot:hover { text-decoration: underline; }
.gate-form .btn-primary.btn-block,
.btn-block { width: 100%; }
.gate-form .btn-primary {
  min-height: 52px;
  margin-top: 6px;
  border-radius: 14px;
  font-size: 1.0625rem;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(194, 24, 91, 0.22);
}
.login-or {
  display: flex; align-items: center; gap: 12px;
  margin: 22px 0 16px; color: var(--muted); font-size: 0.875rem;
}
.login-or::before, .login-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.btn-sso {
  min-height: 52px; display: flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 14px; font-weight: 700; color: var(--pink-700);
  background: #fff; text-decoration: none;
  border: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(59, 31, 43, 0.04);
}
.btn-sso svg { width: 18px; height: 18px; }
.btn-sso:hover { background: var(--pink-50); color: var(--pink-700); border-color: var(--pink-200); }
.auth-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.5;
  text-align: center;
}
.gate-foot { width: min(400px, 100%); margin: 8px auto 0; text-align: center; }
.gate-foot p { margin: 0; color: var(--muted); font-size: 0.75rem; line-height: 1.5; }
.gate-foot a { color: var(--pink-600); }

@media (max-width: 920px) {
  .gate { grid-template-columns: 1fr; }
  .gate-story { min-height: auto; padding: 36px 28px 32px; }
  .gate-panel { min-height: auto; padding: 28px 20px 24px; }
  .gate-steps { display: none; }
}

/* —— Theme switch (topbar) —— */
.theme-switch {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: center;
  width: 108px;
  height: 38px;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.85);
  box-shadow: inset 0 1px 2px rgba(59, 31, 43, 0.04);
  flex-shrink: 0;
}
.theme-switch__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc((100% - 6px) / 3);
  height: calc(100% - 6px);
  border-radius: 999px;
  background: linear-gradient(145deg, var(--pink-400), var(--pink-600));
  box-shadow: 0 4px 12px rgba(194, 24, 91, 0.28);
  transition: transform .22s cubic-bezier(.2, .8, .2, 1);
  z-index: 0;
  pointer-events: none;
}
.theme-switch[data-mode="auto"] .theme-switch__thumb { transform: translateX(100%); }
.theme-switch[data-mode="dark"] .theme-switch__thumb { transform: translateX(200%); }
.theme-switch[data-mode="light"] .theme-switch__thumb { transform: translateX(0); }
.theme-switch [data-theme-option] {
  position: relative;
  z-index: 1;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: color .15s ease;
}
.theme-switch [data-theme-option].is-active { color: #fff; }
.theme-switch [data-theme-option]:focus-visible {
  outline: 2px solid rgba(233, 30, 99, 0.45);
  outline-offset: 1px;
}
.theme-switch__auto {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
}
[data-theme="dark"] .theme-switch {
  background: rgba(36, 21, 28, 0.9);
  border-color: var(--line);
}
[data-theme="dark"] .theme-switch [data-theme-option] { color: #c9a0ae; }
[data-theme="dark"] .theme-switch [data-theme-option].is-active { color: #fff; }

/* —— Dark theme surfaces —— */
[data-theme="dark"] .shell,
[data-theme="dark"] .workspace { color: var(--ink); }
[data-theme="dark"] .sidebar {
  background:
    radial-gradient(420px 240px at 0% 0%, rgba(236, 64, 122, 0.22), transparent 58%),
    linear-gradient(180deg, #2a0c18 0%, #1a0810 100%);
  border-color: rgba(255, 182, 210, 0.12);
}
[data-theme="dark"] .sidebar__link:hover {
  background: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .sidebar__link.is-active {
  background: rgba(236, 64, 122, 0.36);
  color: #fff;
}
[data-theme="dark"] .nav-top {
  background: rgba(26, 15, 20, 0.88);
  border-bottom-color: var(--line);
}
[data-theme="dark"] .icon-btn,
[data-theme="dark"] .top-user,
[data-theme="dark"] .notify-panel,
[data-theme="dark"] .user-menu-panel,
[data-theme="dark"] .card,
[data-theme="dark"] .table-wrap,
[data-theme="dark"] .app-footer {
  background: var(--surface);
  color: var(--ink);
}
[data-theme="dark"] .panel {
  background: rgba(36, 21, 28, 0.92);
  color: var(--ink);
}
[data-theme="dark"] .notify-badge { box-shadow: 0 0 0 2px var(--surface); }
[data-theme="dark"] .notify-list li.is-unread a,
[data-theme="dark"] .notify-page-list li.is-unread a {
  background: rgba(236, 64, 122, 0.12);
}
[data-theme="dark"] .notify-list time,
[data-theme="dark"] .notify-page-list time { color: #d4a0b0; }
[data-theme="dark"] .user-menu-panel a.user-menu-logout:hover { background: rgba(159, 18, 57, 0.25); }
[data-theme="dark"] .btn-primary,
[data-theme="dark"] a.btn-primary,
[data-theme="dark"] label.btn-primary {
  color: #fff;
  background: linear-gradient(145deg, var(--pink-400), var(--pink-600));
}
[data-theme="dark"] .btn-ghost,
[data-theme="dark"] a.btn-ghost,
[data-theme="dark"] label.btn-ghost {
  background: rgba(36, 21, 28, 0.75);
  color: var(--pink-400);
  border-color: var(--line);
}
[data-theme="dark"] .btn-ghost:hover,
[data-theme="dark"] a.btn-ghost:hover {
  background: var(--surface);
  color: var(--pink-300);
}
[data-theme="dark"] .btn-sso {
  background: var(--surface);
  color: var(--pink-700);
}
[data-theme="dark"] .btn-sso:hover { background: var(--pink-50); }
[data-theme="dark"] .gate-form .field input,
[data-theme="dark"] .field input,
[data-theme="dark"] .field select,
[data-theme="dark"] .field textarea {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--line);
}
[data-theme="dark"] .auth-body.is-login { background: #140a0f; }
[data-theme="dark"] .gate-panel {
  background: var(--surface);
}
[data-theme="dark"] .login-alert {
  border-color: rgba(236, 64, 122, 0.35);
  background: rgba(159, 18, 57, 0.22);
  color: #ffc2d6;
}
[data-theme="dark"] .badge-draft { background: #3a2e14; color: #ffd54f; }
[data-theme="dark"] .badge-ok { background: rgba(236, 64, 122, 0.16); color: #ffc2d6; }
[data-theme="dark"] .badge-draft { background: rgba(255,255,255,0.06); color: var(--muted); }
[data-theme="dark"] .swal2-popup.mdtw-toast,
[data-theme="dark"] .swal2-popup.mdtw-confirm {
  background: var(--surface) !important;
  color: var(--ink) !important;
}
[data-theme="dark"] .swal2-title { color: var(--ink) !important; }
[data-theme="dark"] .card,
[data-theme="dark"] .md-card,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .empty-state {
  background: var(--surface);
  border-color: var(--line);
}
[data-theme="dark"] .md-card--hero {
  background:
    radial-gradient(700px 220px at 100% 0%, rgba(236, 64, 122, 0.16), transparent 55%),
    var(--surface);
}
[data-theme="dark"] .phase-item,
[data-theme="dark"] .grade-card,
[data-theme="dark"] .grade-fold {
  background: var(--surface-2);
}
[data-theme="dark"] .grade-fold[open] .grade-fold__summary {
  background: rgba(236, 64, 122, 0.1);
}
[data-theme="dark"] .grade-room-item { background: var(--surface); }
[data-theme="dark"] .grade-fold__chev { background: rgba(236, 64, 122, 0.16); }
[data-theme="dark"] .room-card.is-done {
  background: rgba(46, 125, 50, 0.18);
}
[data-theme="dark"] .action-card__icon { background: rgba(236, 64, 122, 0.14); }
[data-theme="dark"] .speed-card {
  background: var(--surface);
}
[data-theme="dark"] .speed-item { background: var(--surface-2); }
[data-theme="dark"] .speed-rank { background: rgba(236, 64, 122, 0.14); color: #ffc2d6; }
[data-theme="dark"] .committee-search input { background: var(--surface-2); }
[data-theme="dark"] .committee-option:has(input:checked) {
  background: rgba(236, 64, 122, 0.16);
}
[data-theme="dark"] .tab { background: rgba(36, 21, 28, 0.7); }
[data-theme="dark"] .budget-row-actions button.link-danger { color: #fb7185; }
[data-theme="dark"] table th {
  background: var(--pink-50);
  color: var(--muted);
}
[data-theme="dark"] table td { border-color: var(--line); }
[data-theme="dark"] .skip:focus { background: var(--surface); color: var(--ink); }


/* Student worksheet list on dashboard */
.ws-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .65rem;
}
.ws-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: .9rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #ffffff;
}
.ws-item__main { min-width: 0; flex: 1; display: grid; gap: .2rem; }
.ws-item__main strong { font-size: 1rem; }
.ws-item__actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}
.empty-state {
  padding: 1.25rem .25rem;
  text-align: center;
}

.settings-system-open {
  display: grid;
  gap: .65rem;
  align-items: end;
}
@media (min-width: 640px) {
  .settings-system-open {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
  }
}


/* Worksheet forms */
.ws-room-picker {
  display: inline-flex;
  align-items: center;
  margin: 0;
}
.ws-room-picker select {
  font: inherit;
  font-size: .875rem;
  font-weight: 600;
  min-height: 40px;
  padding: .45rem .85rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface, #fff);
  color: var(--ink);
  cursor: pointer;
}
.ws-room-picker select:focus {
  outline: 2px solid rgba(233, 30, 99, 0.28);
  border-color: var(--pink-300);
}
.ws-form { display: grid; gap: 1.1rem; }
.ws-form__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .65rem;
  padding-top: .35rem;
  border-top: 1px solid var(--line);
}
.album-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}
.album-pages {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.album-page-tab {
  display: inline-flex;
  align-items: center;
  min-height: 2.2rem;
  padding: .35rem .85rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
}
.album-page-tab.is-active {
  color: #fff;
  background: linear-gradient(145deg, var(--pink-400), var(--pink-600));
  border-color: transparent;
}
.album-toolbar__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .55rem;
}
.album-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .85rem;
}
.album-slot {
  display: grid;
  gap: .55rem;
  padding: .85rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  align-content: start;
}
.album-slot__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.album-slot__preview {
  display: block;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  aspect-ratio: 4 / 3;
  background: rgba(194, 24, 91, 0.04);
}
.album-slot__preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.album-slot__upload,
.album-slot__caption-form {
  display: grid;
  gap: .45rem;
}
.album-slot__drop {
  display: grid;
  gap: .2rem;
  justify-items: center;
  text-align: center;
  padding: 1.1rem .75rem;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: rgba(194, 24, 91, 0.03);
  cursor: pointer;
  font-weight: 600;
}
.album-slot__drop input[type="file"] {
  width: 100%;
  font-size: .78rem;
}
.album-slot__drop small {
  color: var(--muted);
  font-weight: 500;
  font-size: .75rem;
}
.album-slot__empty {
  min-height: 7rem;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1px dashed var(--line);
}
.album-slot__caption-text {
  margin: 0;
  font-size: .85rem;
}
.album-slot__delete {
  margin: 0;
}
@media (max-width: 960px) {
  .album-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .album-grid { grid-template-columns: 1fr; }
}
[data-theme="dark"] .album-page-tab,
[data-theme="dark"] .album-slot {
  background: var(--surface);
}
[data-theme="dark"] .album-slot__drop {
  background: rgba(236, 64, 122, 0.08);
}

.pdf-hub .dash-section-head {
  margin-bottom: 0;
}
.pdf-part-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
}
.pdf-part-card {
  display: grid;
  gap: .55rem;
  padding: .95rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.pdf-part-card.is-empty {
  opacity: .78;
  background: rgba(194, 24, 91, 0.03);
}
.pdf-part-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .55rem;
}
.pdf-part-card__meta {
  margin: 0;
  font-size: .8rem;
}
.pdf-part-card .btn {
  justify-self: start;
}
@media (max-width: 720px) {
  .pdf-part-grid { grid-template-columns: 1fr; }
}
[data-theme="dark"] .pdf-part-card {
  background: var(--surface);
}
.ws-sheet {
  display: grid;
  gap: 1.15rem;
  padding: 1rem 1.05rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    radial-gradient(520px 160px at 100% 0%, rgba(255, 214, 229, 0.35), transparent 55%),
    #ffffff;
}
.ws-sheet__head h2 { margin: 0 0 .25rem; }
.ws-sheet__head p { margin: 0; }
.ws-sheet__meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
}
.ws-sheet__meta--stack {
  grid-template-columns: 1fr;
}
.ws-field--wide { grid-column: 1 / -1; }
.ws-field {
  display: grid;
  gap: .35rem;
  margin: 0;
  font-weight: var(--fw-semibold);
}
.ws-field > span {
  font-size: var(--text-sm);
  color: var(--muted);
}
.ws-field input,
.ws-field select,
.ws-field textarea,
.ws-member-table input,
.ws-member-table select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .65rem .8rem;
  font: inherit;
  color: var(--ink);
  background: #ffffff;
}
.ws-field input:focus,
.ws-field select:focus,
.ws-field textarea:focus,
.ws-member-table input:focus,
.ws-member-table select:focus {
  outline: none;
  border-color: var(--pink-300);
  box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.12);
}
.ws-block {
  display: grid;
  gap: .75rem;
  padding-top: .35rem;
  border-top: 1px dashed var(--line);
}
.ws-block h3 {
  margin: 0;
  font-size: 1.05rem;
}
.ws-block__head {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  align-items: flex-start;
  flex-wrap: wrap;
}
.ws-hint {
  margin: .25rem 0 0;
  font-size: .8rem;
}
.ws-readonly {
  margin: 0;
  min-height: 2.55rem;
  display: flex;
  align-items: center;
  padding: .55rem .8rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(194, 24, 91, 0.04);
  font-weight: 600;
  color: var(--ink);
}
.ws-advisor-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .55rem;
}
.ws-advisor-list__item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .45rem .85rem;
  padding: .7rem .85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.ws-advisor-list__role {
  font-size: .78rem;
  font-weight: 600;
  color: var(--muted);
}
.ws-advisor-list__item strong {
  font-size: .95rem;
}
[data-theme="dark"] .ws-readonly,
[data-theme="dark"] .ws-advisor-list__item {
  background: var(--surface);
}
.ws-advisor-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .75rem;
}
.ws-member-table th.ws-col-no,
.ws-member-table td.ws-col-no {
  width: 3rem;
  text-align: center;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.ws-member-table .ws-col-act,
.ws-form-table .ws-col-act {
  width: 3.25rem;
  text-align: center;
  vertical-align: middle;
}
.ws-icon-btn {
  width: 34px;
  min-width: 34px;
  padding: .35rem;
  border-radius: .7rem;
}
.ws-icon-btn svg {
  display: block;
  flex: 0 0 auto;
}
.ws-member-table .link-danger {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: #9f1239;
  cursor: pointer;
}
.ws-entry-list {
  display: grid;
  gap: .9rem;
}
.ws-entry-card {
  display: grid;
  gap: .85rem;
  padding: .95rem 1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 241, 245, 0.55), rgba(255, 255, 255, 0.9));
}
.ws-entry-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}
.ws-entry-card__no {
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--pink-700);
}
.ws-field-note {
  font-style: normal;
  font-weight: 500;
  color: var(--muted);
  font-size: .78rem;
}
.ws-quad {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .85rem;
}
.ws-quad__cell {
  padding: .85rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}
.ws-entry-card .ws-quad__cell {
  background: #fff;
}
.ws-pair-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .85rem;
}
.ws-entry-card textarea {
  min-height: 5rem;
  resize: vertical;
}
/* ใบงานที่ 3 — แยกกลุ่มวิเคราะห์ / เชื่อมโยงคุณธรรม */
.ws-link-groups {
  display: grid;
  gap: .85rem;
}
.ws-link-group {
  display: grid;
  gap: .65rem;
  padding: .85rem .9rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
}
.ws-link-group--virtue {
  background:
    linear-gradient(180deg, rgba(236, 64, 122, 0.06), rgba(255, 255, 255, 0.9));
  border-color: rgba(194, 24, 91, 0.14);
}
.ws-link-group__title {
  margin: 0;
  font-size: .8rem;
  font-weight: 700;
  color: var(--pink-700, #ad1457);
  letter-spacing: 0.01em;
}
.ws-link-card .ws-pair-grid {
  gap: .75rem;
}
[data-theme="dark"] .ws-link-group {
  background: var(--surface-2);
  border-color: var(--line);
}
[data-theme="dark"] .ws-link-group--virtue {
  background: rgba(236, 64, 122, 0.1);
}
/* ใบงานตาราง (พิมพ์ / ใบงานอื่น) */
.ws-form-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.ws-form-table {
  min-width: 920px;
  margin: 0;
}
.ws-form-table thead th {
  background: #fff5f8;
  vertical-align: bottom;
  font-size: .78rem;
  line-height: 1.35;
  white-space: normal;
}
.ws-th-sub {
  display: block;
  margin-top: .15rem;
  font-size: .68rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
}
.ws-form-table .ws-col-problem,
.ws-form-table .ws-col-cause,
.ws-form-table .ws-col-behavior { width: 22%; }
.ws-form-table .ws-col-virtue { width: 18%; }
.ws-form-table textarea {
  min-height: 4.6rem;
  resize: vertical;
  border-radius: 10px;
}
.ws-form-table tbody td {
  vertical-align: top;
  background: #fff;
}
/* ใบงานที่ 4 — โครงตามแบบฟอร์ม */
.ws-paper-fields {
  display: grid;
  gap: .75rem;
}
.ws-paper-fields__row {
  display: grid;
  gap: .45rem .65rem;
  align-items: center;
  margin: 0;
}
.ws-paper-fields__row--split {
  grid-template-columns: auto minmax(0, 1fr) auto minmax(8rem, .55fr);
}
.ws-paper-fields__label {
  font-size: .86rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}
.ws-paper-fields__label--side {
  color: var(--pink-700);
}
.ws-paper-fields__row input {
  width: 100%;
  border: 0;
  border-bottom: 1.5px dotted rgba(194, 24, 91, 0.35);
  border-radius: 0;
  padding: .45rem .2rem;
  font: inherit;
  color: var(--ink);
  background: transparent;
}
.ws-paper-fields__row input:focus {
  outline: none;
  border-bottom-color: var(--pink-500);
  box-shadow: none;
  background: rgba(255, 241, 245, 0.35);
}
.ws-matrix-table {
  min-width: 640px;
  table-layout: fixed;
}
.ws-matrix-table td {
  width: 50%;
  padding: .75rem;
  border: 1px solid var(--line);
  background: #fff;
}
.ws-matrix-cell .ws-field span {
  color: var(--pink-700);
  font-weight: 700;
}
.ws-matrix-cell textarea {
  min-height: 7rem;
  border-radius: 10px;
}
@media (max-width: 860px) {
  .ws-sheet__meta,
  .ws-advisor-grid,
  .ws-quad,
  .ws-pair-grid { grid-template-columns: 1fr; }
  .ws-paper-fields__row--split {
    grid-template-columns: 1fr;
  }
  .ws-paper-fields__label {
    white-space: normal;
  }
}
[data-theme="dark"] .ws-sheet {
  background:
    radial-gradient(520px 160px at 100% 0%, rgba(236, 64, 122, 0.12), transparent 55%),
    var(--surface);
}
[data-theme="dark"] .ws-quad__cell,
[data-theme="dark"] .ws-entry-card .ws-quad__cell {
  background: var(--surface-2);
  border-color: var(--line);
}
[data-theme="dark"] .ws-entry-card {
  background:
    linear-gradient(180deg, rgba(236, 64, 122, 0.1), rgba(255, 255, 255, 0.02));
  border-color: var(--line);
}
[data-theme="dark"] .ws-form-table-wrap,
[data-theme="dark"] .ws-form-table tbody td {
  background: var(--surface);
  border-color: var(--line);
}
[data-theme="dark"] .ws-form-table thead th {
  background: var(--surface-2);
}
[data-theme="dark"] .ws-paper-fields__row input {
  color: var(--ink);
  border-bottom-color: rgba(236, 64, 122, 0.4);
}
[data-theme="dark"] .ws-paper-fields__row input:focus {
  background: rgba(236, 64, 122, 0.1);
}
[data-theme="dark"] .ws-matrix-table td {
  background: var(--surface);
}
[data-theme="dark"] .ws-field input,
[data-theme="dark"] .ws-field select,
[data-theme="dark"] .ws-field textarea,
[data-theme="dark"] .ws-member-table input,
[data-theme="dark"] .ws-member-table select {
  background: var(--surface-2);
}

/* —— Admin classrooms (assign advisors) —— */
.classroom-page { gap: 1rem; }
.classroom-hero .panel-head-row {
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}
.classroom-hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: .75rem;
}
.classroom-tabs-panel { display: grid; gap: .85rem; }
.classroom-tabs {
  margin: 0;
  gap: .45rem;
}
.classroom-tab {
  display: grid;
  gap: .15rem;
  min-width: 5.5rem;
  text-align: left;
  border-radius: 14px;
  padding: .55rem .8rem;
}
.classroom-tab__grade { font-weight: 700; }
.classroom-tab__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem;
  font-size: .75rem;
  opacity: .9;
}
.classroom-tab__miss {
  color: #9f1239;
  font-weight: 700;
}
.tab.active .classroom-tab__miss { color: #ffe0ea; }
.classroom-progress { display: grid; gap: .4rem; }
.classroom-progress__text {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .45rem .75rem;
}
.classroom-board { display: grid; gap: 1rem; }
.classroom-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .65rem;
}
.classroom-toolbar__filters {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}
.classroom-filter {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: .4rem .8rem;
  font: inherit;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
}
.classroom-filter:hover { color: var(--pink-700); border-color: var(--pink-200); }
.classroom-filter.is-active {
  color: #fff;
  background: linear-gradient(145deg, var(--pink-400), var(--pink-600));
  border-color: transparent;
}
.classroom-toolbar__search {
  flex: 1 1 180px;
  margin: 0;
  min-width: 160px;
}
.classroom-toolbar__search input {
  width: 100%;
  font: inherit;
  padding: .55rem .8rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}
.classroom-toolbar__search input:focus {
  outline: 2px solid rgba(233, 30, 99, 0.25);
  border-color: var(--pink-300);
}
.classroom-add {
  padding: 1rem;
  border-radius: 16px;
  border: 1px dashed var(--pink-200);
  background: var(--pink-50);
  display: grid;
  gap: .85rem;
}
.classroom-add__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}
.classroom-add__head h2 { margin: 0; font-size: 1.05rem; }
.classroom-add__form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .75rem;
  align-items: end;
}
.classroom-add__form label {
  display: grid;
  gap: .3rem;
  font-size: .82rem;
  font-weight: 600;
}
.classroom-add__form input,
.classroom-add__form select {
  font: inherit;
  padding: .6rem .75rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}
.classroom-add__advisor { grid-column: span 1; }
.classroom-add__actions {
  display: flex;
  gap: .5rem;
  grid-column: 1 / -1;
}
.classroom-grade-chip {
  display: inline-flex;
  align-items: center;
  padding: .55rem .85rem;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--pink-400), var(--pink-600));
  color: #fff;
  font-weight: 700;
  width: fit-content;
}
.classroom-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
}
.classroom-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}
.classroom-table th,
.classroom-table td {
  padding: .85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.classroom-table th {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  background: #fffafc;
}
.classroom-table tr:last-child td { border-bottom: 0; }
.classroom-row.is-unassigned td { background: rgba(255, 241, 245, 0.55); }
.classroom-row.is-inactive { opacity: .65; }
.classroom-row.is-editing td {
  box-shadow: inset 3px 0 0 var(--pink-400);
}
.classroom-col-room { width: 5.5rem; white-space: nowrap; }
.classroom-col-status { width: 5.5rem; white-space: nowrap; }
.classroom-col-act {
  width: 8.5rem;
  white-space: nowrap;
  text-align: right;
}
.classroom-assign {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem .65rem;
  align-items: flex-end;
  min-width: 0;
}
.classroom-assign__fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: .5rem .65rem;
  flex: 1 1 280px;
  min-width: 0;
}
.classroom-assign__slot {
  display: grid;
  gap: .25rem;
  margin: 0;
  min-width: 0;
  font-size: .72rem;
  font-weight: 600;
  color: var(--muted);
}
.classroom-assign select {
  width: 100%;
  min-width: 0;
  font: inherit;
  font-size: .875rem;
  font-weight: 500;
  color: var(--ink);
  padding: .55rem .7rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}
.classroom-assign select:focus {
  outline: 2px solid rgba(233, 30, 99, 0.25);
  border-color: var(--pink-300);
}
.classroom-assign .btn-sm {
  flex: 0 0 auto;
  min-height: 38px;
  padding: .4rem .9rem;
  font-size: .82rem;
  box-shadow: 0 4px 10px rgba(194, 24, 91, 0.16);
}
.classroom-assign .btn-sm:hover {
  box-shadow: 0 6px 14px rgba(194, 24, 91, 0.22);
}
@media (max-width: 720px) {
  .classroom-assign__fields { grid-template-columns: 1fr; }
}
.classroom-col-act .budget-row-actions {
  justify-content: flex-end;
  gap: .65rem;
}
.classroom-empty-filter { margin: 0; }
@media (max-width: 900px) {
  .classroom-hero__actions { justify-content: flex-start; }
  .classroom-tabs { flex-wrap: nowrap; overflow-x: auto; padding-bottom: .2rem; }
  .classroom-tab { flex: 0 0 auto; }
  .classroom-add__form { grid-template-columns: 1fr 1fr; }
  .classroom-add__advisor { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .classroom-add__form { grid-template-columns: 1fr; }
}
[data-theme="dark"] .classroom-filter { background: var(--surface); }
[data-theme="dark"] .classroom-filter.is-active {
  background: linear-gradient(145deg, var(--pink-400), var(--pink-600));
  color: #fff;
}
[data-theme="dark"] .classroom-toolbar__search input,
[data-theme="dark"] .classroom-add__form input,
[data-theme="dark"] .classroom-add__form select,
[data-theme="dark"] .classroom-assign select {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--line);
}
[data-theme="dark"] .classroom-add { background: rgba(236, 64, 122, 0.1); }
[data-theme="dark"] .classroom-table th { background: var(--surface-2); }
[data-theme="dark"] .classroom-row.is-unassigned td {
  background: rgba(236, 64, 122, 0.08);
}

/* —— Classroom representatives —— */
.rep-credentials {
  display: grid;
  gap: .85rem;
  border: 1px solid var(--pink-200);
  background:
    linear-gradient(135deg, rgba(255, 241, 245, 0.95), rgba(255, 255, 255, 0.9)),
    var(--surface);
}
.rep-credentials__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}
.rep-credentials__head h2 { margin: .15rem 0 .25rem; font-size: 1.15rem; }
.rep-credentials__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
  margin: 0;
}
.rep-credentials__grid dt {
  margin: 0 0 .2rem;
  font-size: .75rem;
  color: var(--muted);
}
.rep-credentials__grid dd { margin: 0; }
.rep-credentials__grid code {
  display: inline-block;
  padding: .45rem .7rem;
  border-radius: .65rem;
  background: #fff;
  border: 1px solid var(--pink-100);
  font-size: .95rem;
  letter-spacing: .02em;
  word-break: break-all;
}
.rep-credentials__hint { margin: 0; font-size: .85rem; }
.rep-form__email { grid-column: 1 / -1; }
.rep-room-meta { font-size: .75rem; margin-top: .15rem; }
.rep-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .65rem;
}
.rep-item {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .65rem 1rem;
  align-items: flex-start;
  padding: .7rem .85rem;
  border-radius: .75rem;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  overflow: visible;
}
.rep-item.is-disabled { opacity: .72; }
.rep-item__main {
  display: grid;
  gap: .1rem;
  min-width: 12rem;
}
.rep-item__main strong { font-size: .95rem; }
.rep-item__login { font-size: .75rem; }
.rep-item__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .45rem .7rem;
}
/* specificity ต้องชน a.btn / button.btn (0,1,1) */
.btn.btn-sm,
a.btn.btn-sm,
button.btn.btn-sm,
label.btn.btn-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  min-height: 34px;
  height: auto;
  padding: .35rem .75rem;
  font-size: .82rem;
  line-height: 1.2;
  border-radius: .7rem;
  white-space: nowrap;
  box-shadow: none;
}
.btn.btn-primary.btn-sm,
a.btn.btn-primary.btn-sm,
button.btn.btn-primary.btn-sm {
  box-shadow: 0 3px 8px rgba(194, 24, 91, 0.2);
}
.btn.btn-primary.btn-sm:hover,
a.btn.btn-primary.btn-sm:hover {
  box-shadow: 0 5px 12px rgba(194, 24, 91, 0.26);
}
.rep-page .classroom-table-wrap {
  overflow-x: auto;
  overflow-y: visible;
}
.rep-page .classroom-col-status {
  width: 4.5rem;
}
.rep-page .classroom-col-act {
  width: 7rem;
  vertical-align: middle;
  padding-right: 1.1rem;
}
.rep-page .classroom-col-act .btn.btn-sm {
  width: auto;
  min-width: 5.25rem;
}
.rep-item__actions {
  gap: .4rem;
}
.rep-item__actions .badge {
  margin-right: .15rem;
}
.rep-item__actions .btn.btn-sm {
  min-height: 30px;
  padding: .28rem .65rem;
  font-size: .78rem;
}
.rep-item__actions form.inline-form {
  display: inline-flex;
}
@media (max-width: 720px) {
  .rep-credentials__grid { grid-template-columns: 1fr; }
  .rep-item { flex-direction: column; }
  .rep-page .classroom-col-act { width: auto; }
}
[data-theme="dark"] .rep-credentials {
  background:
    radial-gradient(420px 140px at 0% 0%, rgba(236, 64, 122, 0.18), transparent 55%),
    var(--surface);
  border-color: rgba(236, 64, 122, 0.35);
}
[data-theme="dark"] .rep-credentials__grid code,
[data-theme="dark"] .rep-item {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--ink);
}

/* —— Account / profile (SSO-aware, SDW-inspired) —— */
.account-page { gap: 1rem; }
.account-hero h1 { margin: 0 0 .35rem; }
.account-hero .muted { margin: 0; max-width: 42rem; }
.account-hero__kicker {
  margin: 0 0 .35rem;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--pink-600);
}
.account-layout {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}
.account-card {
  display: grid;
  gap: 1rem;
  text-align: center;
  position: sticky;
  top: 1rem;
}
.account-card__avatar-wrap { display: grid; place-items: center; }
.account-card__avatar {
  width: 148px;
  height: 148px;
  border-radius: 2rem;
  object-fit: cover;
  border: 4px solid #fff;
  box-shadow: 0 14px 28px rgba(194, 24, 91, 0.16);
  background: var(--pink-50);
}
.account-card__avatar--fallback {
  display: grid;
  place-items: center;
  font-size: 2.6rem;
  font-weight: 800;
  color: var(--pink-700);
  border: 4px solid #fff;
}
.account-card__meta { display: grid; gap: .35rem; justify-items: center; }
.account-card__meta h2 {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.3;
}
.account-card__role {
  margin: 0;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--pink-600);
}
.account-card__hint {
  margin: .35rem 0 0;
  font-size: .8rem;
  line-height: 1.45;
  color: #7a1f4a;
  background: rgba(236, 64, 122, 0.08);
  border: 1px solid rgba(236, 64, 122, 0.18);
  border-radius: 14px;
  padding: .65rem .75rem;
  text-align: left;
}
.account-card__hint a { font-weight: 700; color: var(--pink-700); }
.account-card__cta { width: 100%; justify-content: center; }
.account-badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .2rem .55rem;
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  background: #f3f0f2;
  color: #5c4a54;
  border: 1px solid var(--line);
}
.account-badge--sso {
  background: rgba(236, 64, 122, 0.12);
  color: var(--pink-700);
  border-color: rgba(236, 64, 122, 0.22);
}
.account-badge--app {
  background: rgba(245, 158, 11, 0.14);
  color: #92400e;
  border-color: rgba(245, 158, 11, 0.28);
}
.account-main { gap: 1rem; min-width: 0; }
.account-section__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .85rem;
  flex-wrap: wrap;
  margin-bottom: .85rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--line);
}
.account-section__head h2 { margin: 0; font-size: 1.05rem; }
.account-section__head .muted { margin: .25rem 0 0; font-size: .85rem; }
.account-section__title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .45rem;
}
.account-section__link {
  font-size: .85rem;
  font-weight: 700;
  color: var(--pink-700);
  text-decoration: none;
}
.account-section__link:hover { text-decoration: underline; }
.account-section--sso {
  background:
    radial-gradient(420px 140px at 100% 0%, rgba(236, 64, 122, 0.08), transparent 55%),
    var(--surface, #fff);
}
.account-section--app {
  background:
    radial-gradient(420px 140px at 100% 0%, rgba(245, 158, 11, 0.08), transparent 55%),
    var(--surface, #fff);
}
.account-callout {
  margin: 0 0 1rem;
  padding: .75rem .9rem;
  border-radius: 14px;
  font-size: .85rem;
  line-height: 1.5;
  color: #7a1f4a;
  background: rgba(236, 64, 122, 0.08);
  border: 1px solid rgba(236, 64, 122, 0.16);
}
.account-fields {
  display: grid;
  gap: .85rem;
  margin: 0;
}
.account-fields--grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .85rem;
}
.account-fields__span { grid-column: 1 / -1; }
.account-fields > div { display: grid; gap: .35rem; min-width: 0; }
.account-fields dt {
  margin: 0;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.account-fields dd { margin: 0; font-weight: 600; word-break: break-word; }
.account-field-tag {
  display: inline-block;
  margin-left: .25rem;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--pink-600);
}
.account-readonly {
  display: block;
  padding: .7rem .85rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #f7f4f6;
  color: var(--ink);
  font-weight: 600;
}
.account-section__actions {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin-top: 1rem;
  padding-top: .85rem;
  border-top: 1px solid var(--line);
}
@media (max-width: 900px) {
  .account-layout { grid-template-columns: 1fr; }
  .account-card { position: static; }
  .account-fields--grid { grid-template-columns: 1fr; }
}
[data-theme="dark"] .account-card__avatar,
[data-theme="dark"] .account-card__avatar--fallback {
  border-color: var(--surface);
}
[data-theme="dark"] .account-readonly {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--ink);
}
[data-theme="dark"] .account-card__hint,
[data-theme="dark"] .account-callout {
  color: #ffc2d6;
  background: rgba(236, 64, 122, 0.14);
  border-color: rgba(236, 64, 122, 0.28);
}
[data-theme="dark"] .account-badge--app {
  background: rgba(245, 158, 11, 0.16);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.3);
}
[data-theme="dark"] .account-section--sso,
[data-theme="dark"] .account-section--app {
  background:
    radial-gradient(420px 140px at 100% 0%, rgba(236, 64, 122, 0.12), transparent 55%),
    var(--surface);
}

/* —— Account / profile (SSO-aware, SDW-inspired) —— */
.account-page { gap: 1rem; }
.account-hero h1 { margin: 0 0 .35rem; }
.account-hero .muted { margin: 0; max-width: 42rem; }
.account-hero__kicker {
  margin: 0 0 .35rem;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--pink-600);
}
.account-layout {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}
.account-card {
  display: grid;
  gap: 1rem;
  text-align: center;
  position: sticky;
  top: 1rem;
}
.account-card__avatar-wrap { display: grid; place-items: center; }
.account-card__avatar {
  width: 148px;
  height: 148px;
  border-radius: 2rem;
  object-fit: cover;
  border: 4px solid #fff;
  box-shadow: 0 14px 28px rgba(194, 24, 91, 0.16);
  background: var(--pink-50);
}
.account-card__avatar--fallback {
  display: grid;
  place-items: center;
  font-size: 2.6rem;
  font-weight: 800;
  color: var(--pink-700);
  border: 4px solid #fff;
}
.account-card__meta { display: grid; gap: .35rem; justify-items: center; }
.account-card__meta h2 {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.3;
}
.account-card__role {
  margin: 0;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--pink-600);
}
.account-card__hint {
  margin: .35rem 0 0;
  font-size: .8rem;
  line-height: 1.45;
  color: #7a1f4a;
  background: rgba(236, 64, 122, 0.08);
  border: 1px solid rgba(236, 64, 122, 0.18);
  border-radius: 14px;
  padding: .65rem .75rem;
  text-align: left;
}
.account-card__hint a { font-weight: 700; color: var(--pink-700); }
.account-card__cta { width: 100%; justify-content: center; }
.account-badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .2rem .55rem;
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  background: #f3f0f2;
  color: #5c4a54;
  border: 1px solid var(--line);
}
.account-badge--sso {
  background: rgba(236, 64, 122, 0.12);
  color: var(--pink-700);
  border-color: rgba(236, 64, 122, 0.22);
}
.account-badge--app {
  background: rgba(245, 158, 11, 0.14);
  color: #92400e;
  border-color: rgba(245, 158, 11, 0.28);
}
.account-main { gap: 1rem; min-width: 0; }
.account-section__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .85rem;
  flex-wrap: wrap;
  margin-bottom: .85rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--line);
}
.account-section__head h2 { margin: 0; font-size: 1.05rem; }
.account-section__head .muted { margin: .25rem 0 0; font-size: .85rem; }
.account-section__title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .45rem;
}
.account-section__link {
  font-size: .85rem;
  font-weight: 700;
  color: var(--pink-700);
  text-decoration: none;
}
.account-section__link:hover { text-decoration: underline; }
.account-section--sso {
  background:
    radial-gradient(420px 140px at 100% 0%, rgba(236, 64, 122, 0.08), transparent 55%),
    var(--surface, #fff);
}
.account-section--app {
  background:
    radial-gradient(420px 140px at 100% 0%, rgba(245, 158, 11, 0.08), transparent 55%),
    var(--surface, #fff);
}
.account-callout {
  margin: 0 0 1rem;
  padding: .75rem .9rem;
  border-radius: 14px;
  font-size: .85rem;
  line-height: 1.5;
  color: #7a1f4a;
  background: rgba(236, 64, 122, 0.08);
  border: 1px solid rgba(236, 64, 122, 0.16);
}
.account-fields {
  display: grid;
  gap: .85rem;
  margin: 0;
}
.account-fields--grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .85rem;
}
.account-fields__span { grid-column: 1 / -1; }
.account-fields > div { display: grid; gap: .35rem; min-width: 0; }
.account-fields dt {
  margin: 0;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.account-fields dd { margin: 0; font-weight: 600; word-break: break-word; }
.account-field-tag {
  display: inline-block;
  margin-left: .25rem;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--pink-600);
}
.account-readonly {
  display: block;
  padding: .7rem .85rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #f7f4f6;
  color: var(--ink);
  font-weight: 600;
}
.account-section__actions {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin-top: 1rem;
  padding-top: .85rem;
  border-top: 1px solid var(--line);
}
@media (max-width: 900px) {
  .account-layout { grid-template-columns: 1fr; }
  .account-card { position: static; }
  .account-fields--grid { grid-template-columns: 1fr; }
}
[data-theme="dark"] .account-card__avatar,
[data-theme="dark"] .account-card__avatar--fallback {
  border-color: var(--surface);
}
[data-theme="dark"] .account-readonly {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--ink);
}
[data-theme="dark"] .account-card__hint,
[data-theme="dark"] .account-callout {
  color: #ffc2d6;
  background: rgba(236, 64, 122, 0.14);
  border-color: rgba(236, 64, 122, 0.28);
}
[data-theme="dark"] .account-badge--app {
  background: rgba(245, 158, 11, 0.16);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.3);
}
[data-theme="dark"] .account-section--sso,
[data-theme="dark"] .account-section--app {
  background:
    radial-gradient(420px 140px at 100% 0%, rgba(236, 64, 122, 0.12), transparent 55%),
    var(--surface);
}
