/**
 * Parents360 application styles
 * Design tokens live in tokens.css (Step 1 — Design System).
 * Component polish lands in Step 2+.
 */
@import url("./tokens.css?v=20260901");

/* Legacy display serif kept for gradual migration; prefer --font-display (Inter). */
@font-face {
  font-family: "Fraunces";
  src: url("/assets/fonts/fraunces-latin-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Fraunces";
  src: url("/assets/fonts/fraunces-latin-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Source Sans 3";
  src: url("/assets/fonts/source-sans-3-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Source Sans 3";
  src: url("/assets/fonts/source-sans-3-latin-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Source Sans 3";
  src: url("/assets/fonts/source-sans-3-latin-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--font-weight-regular);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  background-image: none;
  min-height: 100vh;
}

body.is-nav-open {
  overflow: hidden;
}

a {
  color: var(--color-text-link);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-standard);
}
a:hover { color: var(--color-text-link-hover); text-decoration: underline; }
a:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Semantic type helpers (use in Step 2+; available now) */
.text-display {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: var(--font-weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-text);
}
.text-h1 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--font-weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-text);
}
.text-h2 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--font-weight-semibold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-text);
}
.text-h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--font-weight-semibold);
  line-height: var(--leading-snug);
  color: var(--color-text);
}
.text-subtitle {
  font-size: var(--text-md);
  font-weight: var(--font-weight-medium);
  line-height: var(--leading-normal);
  color: var(--color-text-secondary);
}
.text-body {
  font-size: var(--text-base);
  font-weight: var(--font-weight-regular);
  line-height: var(--leading-normal);
  color: var(--color-text);
}
.text-label {
  font-size: var(--text-xs);
  font-weight: var(--font-weight-semibold);
  line-height: var(--leading-normal);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.text-small {
  font-size: var(--text-sm);
  font-weight: var(--font-weight-regular);
  line-height: var(--leading-normal);
  color: var(--color-text-secondary);
}

.app-shell { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  color: #f7fffe;
  overflow: hidden;
  background:
    radial-gradient(520px 280px at 0% 0%, rgba(224,122,95,.28), transparent 60%),
    radial-gradient(420px 320px at 110% 85%, rgba(255,214,201,.16), transparent 55%),
    linear-gradient(165deg, #07383b 0%, #0b5256 38%, #0d7377 72%, #0a5c60 100%);
  box-shadow: inset -1px 0 0 rgba(255,255,255,.08);
}
.sidebar-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255,255,255,.07), transparent 28%),
    repeating-linear-gradient(
      -18deg,
      transparent 0,
      transparent 11px,
      rgba(255,255,255,.025) 11px,
      rgba(255,255,255,.025) 12px
    );
  opacity: .9;
}
.sidebar-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 1.35rem 1rem 1.15rem;
}
.brand-block {
  display: flex;
  align-items: center;
  gap: .7rem;
  margin-bottom: 1.25rem;
  padding: .25rem .2rem .1rem;
}
.brand-block.has-logo {
  flex-direction: row;
  align-items: center;
  gap: .7rem;
  padding: .25rem .2rem .1rem;
}
.brand-logo {
  flex-shrink: 0;
  width: 2.6rem;
  height: 2.6rem;
  object-fit: cover;
  border-radius: 12px;
  background: rgba(255,255,255,.96);
  box-shadow:
    0 8px 18px rgba(0,0,0,.14),
    inset 0 1px 0 rgba(255,255,255,.45);
}
.brand-block.has-logo .brand-logo {
  width: 2.6rem;
  height: 2.6rem;
}
.brand-mark {
  flex-shrink: 0;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .82rem;
  letter-spacing: -0.03em;
  color: #1a2e2a;
  background:
    linear-gradient(145deg, #ffe0d4 0%, #e07a5f 55%, #c9684f 100%);
  box-shadow:
    0 8px 18px rgba(0,0,0,.18),
    inset 0 1px 0 rgba(255,255,255,.45);
  animation: brand-pulse 4.5s ease-in-out infinite;
}
.brand-text {
  min-width: 0;
  flex: 1;
}
.brand {
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0;
  line-height: var(--leading-tight);
  color: #ffd0c0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.brand-block.has-logo .brand {
  font-size: var(--text-md);
  line-height: var(--leading-tight);
  letter-spacing: -0.015em;
}
.brand span { color: #ffe8df; }
.brand-sub {
  margin: .12rem 0 0;
  opacity: .7;
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.2;
  color: rgba(247, 255, 254, .72);
}
.brand-school {
  margin: .18rem 0 0;
  font-size: var(--text-xs);
  font-weight: 650;
  line-height: 1.25;
  color: #9fe8e2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.nav {
  flex: 1;
  overflow-y: auto;
  padding-right: .15rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.25) transparent;
}
.nav a {
  display: block;
  position: relative;
  color: #e8fffc;
  padding: .62rem .85rem;
  border-radius: 12px;
  margin-bottom: .22rem;
  text-decoration: none;
  font-weight: 600;
  font-size: var(--text-sm);
  transition: background .18s ease, transform .18s ease, box-shadow .18s ease;
}
.nav > a::before,
.nav-group-label::before {
  content: "";
  position: absolute;
  left: .2rem;
  top: 50%;
  width: 3px;
  height: 0;
  border-radius: 99px;
  background: linear-gradient(180deg, #ffd6c9, #e07a5f);
  transform: translateY(-50%);
  transition: height .18s ease;
}
.nav a:hover, .nav a.active {
  background: rgba(255,255,255,.14);
  text-decoration: none;
  transform: translateX(2px);
  box-shadow: 0 8px 20px rgba(0,0,0,.08);
}
.nav a.active::before,
.nav-group-label.is-active::before {
  height: 1.15rem;
}
.nav-group {
  margin-bottom: .22rem;
  border-radius: 12px;
  position: relative;
}
.nav-group-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  position: relative;
  color: #e8fffc;
  padding: .72rem .95rem;
  border-radius: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: background .18s ease, transform .18s ease;
}
.nav-group:hover .nav-group-label,
.nav-group:focus-within .nav-group-label,
.nav-group.is-open .nav-group-label,
.nav-group-label.is-active {
  background: rgba(255,255,255,.14);
  text-decoration: none;
  transform: translateX(2px);
}
.nav-sub {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .22s ease;
  margin: 0 .35rem 0 .55rem;
  padding: 0 0 0 .55rem;
  border-left: 2px solid transparent;
}
.nav-sub-inner {
  overflow: hidden;
  min-height: 0;
}
.nav-group:hover .nav-sub,
.nav-group:focus-within .nav-sub,
.nav-group.is-open .nav-sub {
  grid-template-rows: 1fr;
  border-left-color: rgba(255,255,255,.22);
  margin-bottom: .35rem;
  padding-bottom: .15rem;
}
.nav-sub a {
  padding: .45rem .75rem;
  font-size: .92rem;
  font-weight: 600;
  opacity: .92;
  margin-bottom: .15rem;
}
.nav-sub a::before { display: none; }
.nav-sub a.active {
  background: rgba(255,255,255,.16);
  opacity: 1;
}

/* Admin nav — collapsible workflow sections */
.nav-flow .nav-home-link,
.nav-flow .nav-flow-single {
  margin-bottom: .35rem;
  font-size: var(--text-md);
}
.nav-flow-section {
  margin-bottom: .28rem;
  border-radius: 12px;
}
.nav-flow-toggle {
  display: flex;
  align-items: center;
  gap: .45rem;
  width: 100%;
  margin: 0;
  padding: .58rem .72rem;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .18s ease, transform .18s ease;
}
.nav-flow-toggle:hover,
.nav-flow-section.is-open .nav-flow-toggle {
  background: rgba(255,255,255,.12);
}
.nav-flow-section.is-active .nav-flow-toggle {
  background: rgba(255,255,255,.14);
}
.nav-flow-head {
  display: flex;
  align-items: baseline;
  gap: .45rem;
  flex: 1;
  min-width: 0;
}
.nav-flow-step {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  min-width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  background: rgba(255,214,201,.22);
  color: #ffd6c9;
  font-size: .68rem;
  font-weight: 800;
  line-height: 1;
}
.nav-flow-section.is-active .nav-flow-step,
.nav-flow-section.is-open .nav-flow-step {
  background: linear-gradient(135deg, #e07a5f, #c45c4a);
  color: #fff;
}
.nav-flow-title {
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: rgba(232,255,252,.88);
  line-height: 1.25;
}
.nav-flow-count {
  flex-shrink: 0;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 .28rem;
  border-radius: 999px;
  background: rgba(255,255,255,.12);
  color: rgba(232,255,252,.75);
  font-size: .62rem;
  font-weight: 700;
  line-height: 1.15rem;
  text-align: center;
}
.nav-flow-toggle .nav-caret {
  flex-shrink: 0;
  margin-left: .15rem;
  width: .45rem;
  height: .45rem;
  border-right: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor;
  transform: rotate(45deg);
  opacity: .45;
  transition: transform .18s ease, opacity .18s ease;
}
.nav-flow-section.is-open .nav-flow-toggle .nav-caret {
  transform: rotate(-135deg);
  opacity: .85;
}
.nav-flow-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .22s ease;
}
.nav-flow-section.is-open .nav-flow-panel {
  grid-template-rows: 1fr;
}
.nav-flow-panel-inner {
  overflow: hidden;
  min-height: 0;
}
.nav-flow-hint {
  margin: 0;
  padding: .15rem .72rem .35rem 2.35rem;
  font-size: .67rem;
  line-height: 1.35;
  color: rgba(232,255,252,.48);
}
.nav-flow-links {
  padding: 0 .35rem .35rem .55rem;
  margin-left: .55rem;
  border-left: 2px solid rgba(255,255,255,.14);
}
.nav-flow-section.is-open .nav-flow-links {
  border-left-color: rgba(255,214,201,.28);
}
.nav-flow-links a {
  padding: .44rem .68rem;
  font-size: .86rem;
  margin-bottom: .1rem;
}
.nav-flow-links a::before { display: none; }
.nav-flow-links a .nav-ico svg {
  width: 1rem;
  height: 1rem;
  opacity: .88;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid rgba(255,255,255,.12);
}
.sidebar-account {
  position: relative;
  margin-bottom: .75rem;
}
.sidebar-account > summary {
  list-style: none;
  display: flex;
}
.sidebar-account > summary::-webkit-details-marker {
  display: none;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: .7rem;
  margin: 0;
  width: 100%;
  padding: .55rem .45rem;
  border: 0;
  border-radius: 14px;
  background: rgba(255,255,255,.08);
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background .18s ease, box-shadow .18s ease;
}
.sidebar-user:hover,
.sidebar-user.is-active,
.sidebar-account[open] .sidebar-user,
.sidebar-account.is-open .sidebar-user {
  background: rgba(255,255,255,.16);
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(0,0,0,.12);
}
.sidebar-user.is-active {
  outline: 1px solid rgba(255,214,201,.35);
}
.sidebar-user-caret {
  margin-left: auto;
  flex-shrink: 0;
  width: .42rem;
  height: .42rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  opacity: .7;
  transition: transform .18s ease;
}
.sidebar-account[open] .sidebar-user-caret,
.sidebar-account.is-open .sidebar-user-caret {
  transform: rotate(-135deg);
  margin-top: .25rem;
}
.sidebar-account-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + .4rem);
  z-index: 8;
  display: grid;
  gap: .12rem;
  padding: .35rem;
  border-radius: 12px;
  background: rgba(8, 28, 30, .97);
  border: 1px solid rgba(255,255,255,.16);
  box-shadow: 0 14px 32px rgba(0,0,0,.32);
}
.sidebar:has(.sidebar-account[open]),
.sidebar:has(.sidebar-account.is-open) {
  overflow: visible;
}
.sidebar-account-panel a {
  color: #f7fffe;
  text-decoration: none;
  padding: .55rem .7rem;
  border-radius: 9px;
  font-weight: 600;
  font-size: .86rem;
  line-height: 1.25;
}
.sidebar-account-panel a:hover,
.sidebar-account-panel a.is-active {
  background: rgba(255,255,255,.12);
  text-decoration: none;
}
.sidebar-avatar {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  background: rgba(255,214,201,.92);
  color: #5a2f24;
  flex-shrink: 0;
}
.sidebar-user-meta {
  min-width: 0;
  display: grid;
  gap: .1rem;
}
.sidebar-user-meta strong {
  font-size: .9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-meta span {
  font-size: .75rem;
  opacity: .72;
}
.nav-logout {
  display: block;
  width: 100%;
  text-align: center;
  color: #ffd6c9 !important;
  padding: .6rem .9rem !important;
  border: 1px solid rgba(255,214,201,.28);
  border-radius: 12px;
  font-weight: 700;
  text-decoration: none;
  background: rgba(224,122,95,.12);
  cursor: pointer;
  font: inherit;
}
.nav-logout:hover {
  background: rgba(224,122,95,.22) !important;
  text-decoration: none;
  transform: none !important;
  box-shadow: none !important;
}
.nav-logout::before { display: none !important; }

.app-version {
  margin: .55rem 0 0;
  padding: 0;
  text-align: center;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .04em;
  opacity: .55;
  color: inherit;
  user-select: text;
}

@keyframes brand-pulse {
  0%, 100% { box-shadow: 0 10px 24px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.45); }
  50% { box-shadow: 0 12px 28px rgba(224,122,95,.35), inset 0 1px 0 rgba(255,255,255,.5); }
}

.main { padding: 1.5rem 1.75rem 2.5rem; }
.page-enter {
  animation: page-enter .32s ease both;
}
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(13,115,119,.18);
  border-radius: 999px;
  background: rgba(255,255,255,.88);
  color: var(--ink);
  font-family: var(--font-ui);
  font-weight: 700;
  padding: .68rem 1rem;
  box-shadow: 0 8px 24px rgba(16, 62, 63, .08);
  cursor: pointer;
}
.admin-nav-toggle {
  margin-bottom: 0;
}
.main-tools {
  display: flex;
  align-items: center;
  gap: .55rem;
  margin-bottom: 1rem;
}
.main-tools .admin-nav-toggle {
  margin-right: 0;
}
.page-help-btn {
  position: fixed;
  top: max(.9rem, env(safe-area-inset-top, 0px));
  right: max(.9rem, env(safe-area-inset-right, 0px));
  z-index: 85;
  margin-left: 0;
  flex: 0 0 2.5rem;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 2px solid var(--teal, #0d7377);
  border-radius: 50%;
  background: var(--card, #fff);
  color: var(--teal, #0d7377);
  font-family: var(--font-display, inherit);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(16, 62, 63, .1);
}
.page-help-btn:hover,
.page-help-btn:focus-visible {
  background: var(--teal, #0d7377);
  color: #fff;
  outline: none;
}
.page-help-btn[aria-expanded="true"] {
  background: var(--teal, #0d7377);
  color: #fff;
}
.page-help-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(8, 28, 30, .58);
}
.page-help-panel[hidden] {
  display: none !important;
}
.page-help-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 91;
  width: min(46rem, calc(100vw - 1.4rem));
  height: min(88dvh, 54rem);
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  background: var(--card, #fff);
  border-radius: 18px;
  box-shadow: 0 28px 70px rgba(8, 28, 30, .32);
  overflow: hidden;
}
body.is-page-help-open .page-help-panel {
  transform: translate(-50%, -50%);
}
.page-help-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem .9rem;
  border-bottom: 1px solid var(--line, #dce5e4);
  background: #12383b;
  color: #f7fffe;
  flex: 0 0 auto;
}
.page-help-kicker {
  margin: 0 0 .2rem;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #9fe8e2;
}
.page-help-head h2 {
  margin: 0;
  font-family: var(--font-display, inherit);
  font-size: 1.35rem;
  line-height: 1.25;
  color: #fff;
}
.page-help-close {
  flex: 0 0 2.3rem;
  width: 2.3rem;
  height: 2.3rem;
  border: 0;
  border-radius: 8px;
  background: rgba(255,255,255,.1);
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}
.page-help-close:hover {
  background: rgba(255,255,255,.2);
}
.page-help-body {
  flex: 1;
  overflow: auto;
  padding: 1.1rem 1.15rem 1.6rem;
  display: grid;
  gap: 1.15rem;
  width: 100%;
  background: #f4f7f6;
}
.page-help-hero {
  margin: 0;
  background: #fff;
  border: 1px solid var(--line, #dce5e4);
  border-radius: 14px;
  overflow: hidden;
}
.page-help-hero .page-help-scene {
  display: block;
  width: 100%;
  height: auto;
}
.page-help-hero figcaption {
  margin: 0;
  padding: .45rem .8rem .6rem;
  font-size: .78rem;
  color: var(--muted, #667);
}
.page-help-story {
  background: #fff;
  border: 1px solid var(--line, #dce5e4);
  border-radius: 14px;
  padding: 1rem 1.05rem 1.1rem;
}
.page-help-story p {
  font-size: 1.08rem;
  line-height: 1.55;
}
.page-help-helps {
  margin-top: .7rem !important;
  padding-top: .7rem;
  border-top: 1px dashed var(--line, #dce5e4);
}
.page-help-body h3 {
  margin: 0 0 .55rem;
  font-size: 1.05rem;
  font-family: var(--font-display, inherit);
}
.page-help-body h4 {
  margin: 0 0 .25rem;
  font-size: .98rem;
}
.page-help-body p,
.page-help-body li {
  margin: 0;
  color: var(--color-text-secondary, #334);
  font-size: 1rem;
  line-height: 1.55;
}
.page-help-cards {
  display: grid;
  gap: .7rem;
}
.page-help-card {
  display: grid;
  grid-template-columns: 3.1rem 1fr;
  gap: .75rem;
  align-items: start;
  background: #fff;
  border: 1px solid var(--line, #dce5e4);
  border-radius: 14px;
  padding: .8rem .85rem;
}
.page-help-card-pic {
  width: 3.1rem;
  height: 3.1rem;
  border-radius: 12px;
  background: #e7f3f2;
  display: grid;
  place-items: center;
}
.page-help-mini {
  width: 1.7rem;
  height: 1.7rem;
}
.page-help-tips {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: .45rem;
}
body.is-page-help-open {
  overflow: hidden;
}
.portal-help-tools {
  margin-bottom: .85rem;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.topbar h1 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  margin: 0;
  letter-spacing: -0.02em;
  line-height: var(--leading-tight);
}
.topbar p { margin: .2rem 0 0; color: var(--muted); font-size: var(--text-sm); }

.grid { display: grid; gap: 1rem; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.2rem;
}
.stat-label { color: var(--muted); font-size: var(--text-sm); font-weight: 600; }
.stat-value {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  margin-top: .2rem;
  letter-spacing: -0.03em;
  line-height: var(--leading-tight);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  border: 0;
  border-radius: 999px;
  padding: .52rem .95rem;
  font-weight: 700;
  font-size: var(--text-sm);
  cursor: pointer;
  font-family: var(--font-ui);
  text-decoration: none;
}
.btn:hover { text-decoration: none; filter: brightness(1.05); }
.btn-primary { background: var(--teal); color: #fff; }
.btn-coral { background: var(--coral); color: #fff; }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .75rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }

.invoice-table-wrap {
  overflow: visible;
  max-height: min(70vh, 720px);
  overflow-y: auto;
}
.invoice-table th,
.invoice-table td {
  padding: .55rem .4rem;
  vertical-align: middle;
}
.invoice-table tr.is-cancelled { opacity: .65; }
.invoice-table .invoice-sub {
  color: var(--muted);
  font-size: .8rem;
  font-weight: 500;
  margin-top: .15rem;
}
.invoice-table .invoice-sum {
  font-family: var(--font-display);
  font-weight: 700;
  white-space: nowrap;
}
.invoice-edit-row td {
  background: #f7fbf9;
  border-bottom: 1px solid var(--line);
}
.invoice-row-details {
  display: grid;
  gap: .3rem;
  font-size: .88rem;
  margin-bottom: .55rem;
}
.invoice-row-details .muted {
  color: var(--muted);
  font-weight: 600;
  margin-right: .35rem;
  font-size: .8rem;
}
.invoice-fee {
  color: var(--danger);
  font-weight: 600;
}
.invoice-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: flex-end;
}
.invoice-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  align-items: center;
  justify-content: flex-end;
}
.invoice-upload,
.invoice-cancel {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  align-items: center;
}
.invoice-upload input[type="file"],
.invoice-upload input[type="password"],
.invoice-cancel input[type="password"] {
  min-width: 0;
  width: auto;
  max-width: 11rem;
  padding: .4rem .55rem;
  font-size: .85rem;
}

.child-ac {
  position: relative;
}
.child-ac-list {
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  top: calc(100% + .25rem);
  margin: 0;
  padding: .35rem;
  list-style: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  max-height: 240px;
  overflow-y: auto;
}
.child-ac-list li {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  align-items: baseline;
  padding: .55rem .7rem;
  border-radius: 8px;
  cursor: pointer;
}
.child-ac-list li:hover,
.child-ac-list li:focus {
  background: #eef7f3;
}
.child-ac-list li span {
  color: var(--muted);
  font-size: .82rem;
  white-space: nowrap;
}

.form-grid { display: grid; gap: .85rem; }
label { display: grid; gap: .35rem; font-weight: 600; font-size: var(--text-sm); }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .7rem .8rem;
  font: inherit;
  background: #fff;
}
.actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .5rem; }
.badge {
  display: inline-block;
  border-radius: 999px;
  padding: .2rem .55rem;
  font-size: .75rem;
  font-weight: 700;
}
.badge-ok { background: #d8f3ef; color: #0f6b63; }
.badge-warn { background: #fff1cc; color: #8a6d12; }
.badge-danger { background: #fde2df; color: #8f2f24; }
.badge-muted { background: #eef2f1; color: #4d5f5a; }

.flash {
  border-radius: 14px;
  padding: .8rem 1rem;
  margin-bottom: 1rem;
  font-weight: 600;
  box-shadow: 0 10px 24px rgba(16, 62, 63, .08);
}
.flash-ok { background: #d8f3ef; color: #0f6b63; }
.flash-err { background: #fde2df; color: #8f2f24; }
.flash.is-dismissing {
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .25s ease, transform .25s ease;
}

.toast-stack {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  display: grid;
  gap: .75rem;
  z-index: 1200;
}
.toast {
  min-width: min(360px, calc(100vw - 2rem));
  padding: .9rem 1rem;
  border-radius: 16px;
  background: rgba(16, 62, 63, .96);
  color: #fff;
  box-shadow: 0 18px 44px rgba(8, 25, 26, .26);
}
.toast strong {
  display: block;
  margin-bottom: .2rem;
}

.auth-page {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  overflow: hidden;
  background:
    radial-gradient(900px 520px at 12% -8%, rgba(13,115,119,.18), transparent 58%),
    radial-gradient(780px 480px at 100% 0%, rgba(224,122,95,.16), transparent 52%),
    linear-gradient(165deg, #e8f3f0 0%, #f5f8f6 42%, #eef2ef 100%);
}
.auth-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  background: rgba(255,255,255,.9);
  border: 1px solid rgba(213,227,221,.95);
  border-radius: 28px;
  box-shadow:
    0 24px 60px rgba(13, 64, 66, .1),
    0 2px 0 rgba(255,255,255,.7) inset;
  padding: 2rem 1.7rem;
}
.auth-card-wide {
  width: min(480px, 100%);
}
.auth-card h1 {
  font-family: var(--font-display);
  margin: 0 0 .35rem;
}
.auth-card .lead { color: var(--muted); margin: 0 0 1.4rem; line-height: 1.45; }
.auth-body .auth-card {
  backdrop-filter: blur(18px);
}
.auth-eyebrow {
  margin: 0 0 .55rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .72rem;
  font-weight: 700;
  color: var(--teal-dark);
}
.auth-brand {
  letter-spacing: -0.03em;
  font-size: var(--text-2xl);
  line-height: var(--leading-tight);
}
.auth-foot {
  margin: 1.15rem 0 0;
  color: var(--muted);
  text-align: center;
}
.auth-hero {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.auth-hero-glow {
  position: absolute;
  inset: 8% 12%;
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 40%, rgba(13,115,119,.22), transparent 55%),
    radial-gradient(circle at 70% 45%, rgba(224,122,95,.2), transparent 48%);
  filter: blur(52px);
  animation: portalGlow 10s ease-in-out infinite alternate;
}
@keyframes portalGlow {
  from { transform: translate3d(-1%, 0, 0) scale(1); opacity: .85; }
  to { transform: translate3d(2%, 1.5%, 0) scale(1.05); opacity: 1; }
}

.portal-body {
  min-height: 100vh;
  background:
    radial-gradient(1100px 560px at -5% -15%, rgba(13,115,119,.14), transparent 55%),
    radial-gradient(900px 520px at 110% -5%, rgba(224,122,95,.12), transparent 50%),
    linear-gradient(180deg, #eaf3f0 0%, #f4f7f5 38%, #eef2ef 100%);
}
.portal-app-frame {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}
.portal-shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1rem 1rem 2.5rem;
  flex: 1;
  width: 100%;
}
.portal-header {
  position: sticky;
  top: .75rem;
  z-index: 30;
  margin-bottom: 1.35rem;
  padding: .95rem 1.1rem 1.05rem;
  border: 1px solid rgba(255,255,255,.55);
  border-radius: 26px;
  background: linear-gradient(145deg, rgba(255,255,255,.86), rgba(255,255,255,.72));
  backdrop-filter: blur(22px) saturate(1.2);
  box-shadow:
    0 18px 40px rgba(16, 62, 63, .1),
    0 1px 0 rgba(255,255,255,.8) inset;
}
.portal-brand-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
}
.portal-brand {
  display: flex;
  align-items: center;
  gap: .7rem;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}
.portal-brand:hover { text-decoration: none; }
.portal-brand strong {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  letter-spacing: -0.02em;
  line-height: var(--leading-tight);
  color: #d98a72;
}
.portal-brand small {
  display: block;
  margin-top: .12rem;
  color: var(--muted);
  font-size: .8rem;
}
.portal-brand small.portal-school {
  color: #2a9a94;
  font-weight: 650;
}
.portal-brand-logo,
.portal-brand-mark {
  width: 3rem;
  height: 3rem;
  border-radius: 16px;
  object-fit: contain;
  background: #fff;
  box-shadow: 0 8px 18px rgba(13,115,119,.16);
  flex-shrink: 0;
}
.portal-brand-logo {
  padding: .2rem;
  box-sizing: border-box;
}
.auth-logo-wrap {
  display: flex;
  justify-content: center;
  margin: 0 0 1rem;
}
.auth-logo {
  width: 4.5rem;
  height: 4.5rem;
  object-fit: contain;
  border-radius: 18px;
  background: #fff;
  padding: .35rem;
  box-sizing: border-box;
  box-shadow: 0 10px 24px rgba(13,115,119,.14);
}
.portal-brand-mark {
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #0f7f83 0%, #0d7377 45%, #0a5558 100%);
  color: #f7fffe;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .85rem;
}
.portal-nav-wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: .95rem;
  padding-top: .9rem;
  border-top: 1px solid rgba(13,115,119,.08);
}
.portal-nav,
.portal-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .45rem;
}
.portal-actions .app-version {
  width: 100%;
  text-align: left;
  margin: .15rem 0 0;
  opacity: .5;
}
.portal-more-sheet .app-version {
  margin: .45rem 0 0;
  text-align: center;
  opacity: .5;
}
.portal-nav a {
  padding: .52rem .95rem;
  border-radius: 999px;
  font-weight: 650;
  font-size: var(--text-sm);
  color: var(--ink);
  background: transparent;
  text-decoration: none;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
.portal-nav a:hover {
  background: rgba(13,115,119,.08);
  text-decoration: none;
  transform: translateY(-1px);
}
.portal-nav a.active {
  background: linear-gradient(145deg, #124f52, #0d7377);
  color: #fff;
  box-shadow: 0 8px 18px rgba(13,115,119,.22);
  text-decoration: none;
}
.portal-main {
  display: grid;
  gap: 1.1rem;
}
.portal-body .topbar {
  align-items: end;
  margin-bottom: .15rem;
}
.portal-body .topbar h1 {
  font-size: var(--text-xl);
  letter-spacing: -0.03em;
  margin: 0;
  line-height: var(--leading-tight);
}
.portal-body .topbar p {
  margin: .35rem 0 0;
  color: var(--muted);
  font-size: var(--text-sm);
}
.portal-body .card {
  border: 1px solid rgba(255,255,255,.7);
  background: rgba(255,255,255,.84);
  backdrop-filter: blur(10px);
  border-radius: 22px;
  box-shadow: 0 14px 34px rgba(16, 62, 63, .06);
  transition: transform .2s ease, box-shadow .2s ease;
}
.portal-body .card:hover {
  box-shadow: 0 18px 40px rgba(16, 62, 63, .09);
}
.portal-stat {
  position: relative;
  overflow: hidden;
  padding: 1.15rem 1.2rem 1.2rem;
}
.portal-stat::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, #0d7377, #e07a5f);
}
html[dir="rtl"] .portal-stat::before {
  inset-inline-start: auto;
  inset-inline-end: 0;
}
.portal-stat .stat-label {
  font-size: var(--text-xs);
  letter-spacing: .02em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--muted);
}
.portal-stat .stat-value {
  margin-top: .35rem;
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  letter-spacing: -0.03em;
  line-height: 1;
}
.portal-tabbar,
.portal-more-backdrop,
.portal-more-sheet,
.portal-guest-bar {
  display: none;
}
.portal-body.portal-app {
  background: #d9e8e5;
}
.portal-body.portal-app .portal-app-frame {
  max-width: 100%;
  width: 100%;
  margin: 0;
  background:
    radial-gradient(520px 280px at 10% -10%, rgba(13,115,119,.12), transparent 55%),
    radial-gradient(420px 260px at 100% 0%, rgba(224,122,95,.1), transparent 50%),
    linear-gradient(180deg, #f3f8f6 0%, #eef4f2 100%);
  box-shadow: none;
}
.portal-body.portal-app .portal-shell {
  max-width: none;
  margin: 0;
  padding: 0 0 calc(4.75rem + env(safe-area-inset-bottom, 0px));
}
.portal-body.portal-app .portal-header {
  top: 0;
  margin-bottom: 0;
  padding: .7rem .9rem;
  padding-top: calc(.7rem + env(safe-area-inset-top, 0px));
  border: 0;
  border-radius: 0;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(18px) saturate(1.15);
  box-shadow: 0 1px 0 rgba(13,115,119,.08);
}
.portal-body.portal-app .portal-appbar {
  border-bottom: 1px solid rgba(13,115,119,.08);
}
.portal-body.portal-app .portal-brand strong {
  font-size: var(--text-md);
  max-width: 11.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.portal-body.portal-app .portal-brand small { font-size: var(--text-xs); }
.portal-body.portal-app .portal-brand-logo,
.portal-body.portal-app .portal-brand-mark {
  width: 2.55rem;
  height: 2.55rem;
  border-radius: 14px;
}
.portal-body.portal-app .portal-nav-wrap { display: none !important; }
.portal-body.portal-app .portal-nav-toggle { display: none !important; }
.portal-body.portal-app .portal-main {
  gap: .95rem;
  padding: .95rem .9rem 1.25rem;
}
.portal-body.portal-app .topbar h1 { font-size: var(--text-lg); }
.portal-body.portal-app .topbar p { font-size: var(--text-sm); }
.portal-body.portal-app .card { border-radius: 18px; }
.portal-body.portal-app .portal-stat { padding: 1rem 1.05rem; }
.portal-body.portal-app .portal-stat .stat-value { font-size: var(--text-xl); }
.portal-body.portal-app .portal-tabbar {
  display: grid;
  position: fixed;
  left: 0;
  right: 0;
  transform: none;
  bottom: 0;
  z-index: 50;
  width: 100%;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: .1rem;
  padding: .4rem .35rem calc(.4rem + env(safe-area-inset-bottom, 0px));
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(18px) saturate(1.2);
  border-top: 1px solid rgba(13,115,119,.1);
  box-shadow: 0 -10px 28px rgba(16, 62, 63, .08);
}
.portal-body.portal-app .portal-more-backdrop:not([hidden]) { display: block; }
.portal-body.portal-app .portal-more-sheet:not([hidden]) { display: block; }
.portal-body.portal-app .portal-guest-bar { display: block; }

/* Mobile / app: full-bleed, no horizontal scroll */
.portal-body.portal-app,
.portal-body.portal-app .portal-app-frame {
  overflow-x: hidden;
  width: 100%;
  max-width: 100%;
}
.portal-body.portal-app .portal-app-frame {
  max-width: 100%;
}
.portal-body.portal-app .portal-shell,
.portal-body.portal-app .portal-main,
.portal-body.portal-app .card,
.portal-body.portal-app .topbar {
  max-width: 100%;
  min-width: 0;
}
.portal-body.portal-app .portal-main {
  overflow-x: hidden;
}
.portal-body.portal-app .grid-4,
.portal-body.portal-app .grid-3,
.portal-body.portal-app .grid-2,
.portal-body.portal-app .form-grid-2,
.portal-body.portal-app .form-grid-3 {
  grid-template-columns: 1fr !important;
}
.portal-body.portal-app .portal-panel-head {
  flex-direction: column;
  align-items: stretch;
  gap: .65rem;
}
.portal-body.portal-app .portal-panel-head .btn {
  width: 100%;
  justify-content: center;
}
.portal-body.portal-app .actions {
  flex-wrap: wrap;
}
.portal-body.portal-app .actions .btn {
  width: 100%;
  justify-content: center;
}
.portal-body.portal-app input,
.portal-body.portal-app select,
.portal-body.portal-app textarea,
.portal-body.portal-app .btn {
  max-width: 100%;
}
.portal-body.portal-app .table-wrap {
  overflow: visible !important;
  border: 0 !important;
  border-radius: 0 !important;
  -webkit-overflow-scrolling: auto;
}
.portal-body.portal-app .table-wrap table {
  min-width: 0 !important;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 .65rem;
}
.portal-body.portal-app .table-wrap thead {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.portal-body.portal-app .table-wrap tbody tr {
  display: grid;
  gap: .35rem;
  padding: .85rem .9rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f7fbf9;
}
.portal-body.portal-app .table-wrap tbody td {
  display: grid;
  grid-template-columns: minmax(5.5rem, 38%) minmax(0, 1fr);
  align-items: start;
  gap: .55rem;
  border: 0 !important;
  padding: .2rem 0 !important;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.portal-body.portal-app .table-wrap tbody td::before {
  content: attr(data-label);
  font-size: .72rem;
  font-weight: 750;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.35;
  padding-top: .1rem;
}
.portal-body.portal-app .child-card-head {
  flex-wrap: wrap;
}
.portal-body.portal-app .portal-article p,
.portal-body.portal-app .hint,
.portal-body.portal-app .topbar p {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Desktop browsers: never use the phone-frame app chrome */
@media (min-width: 901px) {
  .portal-body.portal-app .portal-app-frame {
    max-width: none;
    margin: 0;
    background: transparent;
    box-shadow: none;
  }
  .portal-body.portal-app .portal-shell {
    max-width: 1120px;
    margin: 0 auto;
    padding: 1rem 1rem 2.5rem;
  }
  .portal-body.portal-app .portal-header {
    position: sticky;
    top: .75rem;
    margin-bottom: 1.35rem;
    padding: .95rem 1.1rem 1.05rem;
    border: 1px solid rgba(255,255,255,.55);
    border-radius: 26px;
    background: linear-gradient(145deg, rgba(255,255,255,.86), rgba(255,255,255,.72));
    box-shadow:
      0 18px 40px rgba(16, 62, 63, .1),
      0 1px 0 rgba(255,255,255,.8) inset;
  }
  .portal-body.portal-app .portal-nav-wrap { display: flex !important; }
  .portal-body.portal-app .portal-tabbar,
  .portal-body.portal-app .portal-guest-bar,
  .portal-body.portal-app .portal-more-sheet,
  .portal-body.portal-app .portal-more-backdrop {
    display: none !important;
  }
  .portal-body.portal-app .portal-main {
    padding: 0;
    gap: 1.1rem;
  }
  .portal-body.portal-app .portal-brand strong {
    max-width: none;
    white-space: normal;
    font-size: 1.2rem;
  }
  .portal-ui-chooser { display: none !important; }
}
.portal-tab {
  appearance: none;
  border: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .18rem;
  min-height: 3.15rem;
  padding: .2rem .15rem;
  border-radius: 14px;
  color: #5d736f;
  text-decoration: none;
  font: inherit;
  cursor: pointer;
}
.portal-tab:hover { text-decoration: none; color: #0d7377; }
.portal-tab.is-active {
  color: #0d7377;
  background: rgba(13,115,119,.1);
}
.portal-tab-icon {
  width: 1.35rem;
  height: 1.35rem;
  display: grid;
  place-items: center;
}
.portal-tab-icon svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: currentColor;
  stroke: none;
}
.portal-tab-label {
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .01em;
  line-height: 1.1;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.portal-more-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(10, 40, 42, .42);
  backdrop-filter: blur(2px);
}
.portal-more-sheet {
  position: fixed;
  left: 0;
  right: 0;
  transform: none;
  bottom: 0;
  z-index: 70;
  width: 100%;
  max-height: min(78vh, 560px);
  overflow: auto;
  padding: .55rem .95rem calc(1.1rem + env(safe-area-inset-bottom, 0px));
  border-radius: 22px 22px 0 0;
  background: #fff;
  box-shadow: 0 -18px 40px rgba(16, 62, 63, .18);
}
.portal-more-handle {
  width: 2.4rem;
  height: .28rem;
  border-radius: 999px;
  background: rgba(13,115,119,.18);
  margin: .15rem auto .85rem;
}
.portal-more-user {
  margin-bottom: .75rem;
}
.portal-more-nav {
  display: grid;
  gap: .35rem;
}
.portal-more-nav a {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .8rem .85rem;
  border-radius: 14px;
  color: var(--ink);
  font-weight: 650;
  text-decoration: none;
  background: #f4f8f7;
}
.portal-more-nav a:hover { text-decoration: none; background: #eaf4f2; }
.portal-more-nav a.active {
  background: rgba(13,115,119,.12);
  color: #0a5558;
}
.portal-more-nav .portal-tab-icon {
  color: #0d7377;
}
.portal-more-logout {
  margin-top: .85rem;
}
.portal-more-logout .btn {
  width: 100%;
  justify-content: center;
}
.portal-guest-bar {
  position: fixed;
  left: 0;
  right: 0;
  transform: none;
  bottom: 0;
  z-index: 50;
  width: 100%;
  padding: .75rem .9rem calc(.75rem + env(safe-area-inset-bottom, 0px));
  background: rgba(255,255,255,.96);
  border-top: 1px solid rgba(13,115,119,.1);
}
.portal-guest-bar .btn { width: 100%; justify-content: center; }
body.portal-more-open { overflow: hidden; }

.portal-ui-chooser {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(8, 36, 38, .48);
  backdrop-filter: blur(6px);
}
.portal-ui-chooser.is-open:not([hidden]) {
  display: flex;
}
.portal-ui-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 22px;
  padding: 1.35rem 1.3rem 1.2rem;
  box-shadow: 0 24px 50px rgba(16, 62, 63, .22);
}
.portal-ui-card h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  letter-spacing: -0.02em;
  line-height: var(--leading-tight);
}
.portal-ui-card > p {
  margin: .55rem 0 1rem;
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}
.portal-ui-actions {
  display: grid;
  gap: .55rem;
}
.portal-ui-actions .btn {
  justify-content: center;
  width: 100%;
}
.portal-ui-hint {
  margin: .85rem 0 0 !important;
  font-size: .82rem !important;
}

.portal-user-chip {
  display: grid;
  gap: .06rem;
  padding: .65rem .85rem;
  border-radius: 14px;
  background: rgba(13,115,119,.07);
  border: 1px solid rgba(13,115,119,.08);
}
.portal-user-chip strong { font-size: var(--text-sm); }
.portal-user-chip span {
  font-size: var(--text-xs);
  color: var(--muted);
}

.portal-login-app .portal-login-frame {
  max-width: 100%;
  width: 100%;
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 1.25rem .9rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: center;
}
@media (min-width: 901px) {
  .portal-login-app .portal-login-frame {
    max-width: 430px;
    margin: 0 auto;
  }
}
.portal-login-app .auth-card {
  width: 100%;
  border-radius: 22px;
}

.portal-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  margin-bottom: .65rem;
}
.portal-panel-head .section-title {
  margin: 0;
}
.portal-stack {
  display: grid;
  gap: .85rem;
}
.portal-article {
  padding-bottom: .85rem;
  border-bottom: 1px solid var(--line);
}
.portal-article-full {
  display: grid;
  gap: .35rem;
}
.portal-article-full strong {
  font-size: 1.05rem;
}
.portal-body .table-wrap {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
/* Wide tables only on desktop — on phones they stack as cards (no sideways scroll) */
@media (min-width: 901px) {
  .portal-body table {
    min-width: 480px;
  }
}
@media (max-width: 900px) {
  html, .portal-body {
    overflow-x: hidden;
    max-width: 100%;
  }
  .portal-body .portal-app-frame,
  .portal-body .portal-shell,
  .portal-body .portal-main {
    max-width: 100%;
    width: 100%;
    min-width: 0;
    overflow-x: hidden;
  }
  .portal-body .table-wrap {
    overflow: visible !important;
    border: 0 !important;
    border-radius: 0 !important;
  }
  .portal-body .table-wrap table {
    min-width: 0 !important;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 .65rem;
  }
  .portal-body .table-wrap thead {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .portal-body .table-wrap tbody tr {
    display: grid;
    gap: .35rem;
    padding: .85rem .9rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #f7fbf9;
  }
  .portal-body .table-wrap tbody td {
    display: grid;
    grid-template-columns: minmax(5.5rem, 38%) minmax(0, 1fr);
    align-items: start;
    gap: .55rem;
    border: 0 !important;
    padding: .2rem 0 !important;
    word-break: break-word;
    overflow-wrap: anywhere;
  }
  .portal-body .table-wrap tbody td::before {
    content: attr(data-label);
    font-size: .72rem;
    font-weight: 750;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: var(--muted);
    line-height: 1.35;
    padding-top: .1rem;
  }
  .portal-body .grid-4,
  .portal-body .grid-3,
  .portal-body .grid-2,
  .portal-body .form-grid-2,
  .portal-body .form-grid-3 {
    grid-template-columns: 1fr !important;
  }
}
.portal-body thead th {
  font-size: .72rem;
}
.portal-body tbody tr {
  transition: background .15s ease;
}
.portal-body tbody tr:hover {
  background: rgba(13,115,119,.04);
}
.portal-body .btn-ghost {
  background: rgba(255,255,255,.7);
  border-color: rgba(13,115,119,.16);
}
.portal-nav-toggle {
  display: none;
  border: 1px solid rgba(13,115,119,.18);
  background: rgba(255,255,255,.7);
  color: var(--ink);
  border-radius: 999px;
  padding: .45rem .9rem;
  font-weight: 700;
}

.plans-split {
  align-items: start;
  gap: 1.15rem;
}
.plans-col-title {
  margin: 0 0 .75rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
}
.plans-create {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f7fbf9;
}
.plans-list {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  max-height: min(70vh, 640px);
  overflow-y: auto;
  padding-right: .15rem;
}
.plan-edit-card {
  margin: 0;
  padding: .85rem .9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
@media (max-width: 900px) {
  .plans-split { grid-template-columns: 1fr; }
}
.install-card {
  width: min(760px, 100%);
}
.install-check {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.install-steps {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
}
.install-steps li {
  flex: 1 1 7rem;
  min-width: 6.5rem;
  font-size: .78rem;
  font-weight: 600;
  color: var(--muted);
  background: #f3f6f5;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .35rem .65rem;
  text-align: center;
}
.install-steps li.is-done {
  color: #0f6b63;
  background: #d8f3ef;
  border-color: #b7e4de;
}
.install-steps li.is-current {
  color: #fff;
  background: var(--teal-dark, #0d7377);
  border-color: transparent;
}
.install-hint-box {
  margin: 0 0 1rem;
  padding: .75rem .9rem;
  border-radius: 12px;
  background: #fff8e8;
  border: 1px solid #f0e0b8;
  color: #5c4a16;
  font-size: .92rem;
  line-height: 1.45;
}

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

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, 320px);
    height: 100vh;
    transform: translateX(-104%);
    transition: transform .26s ease;
    z-index: 40;
  }
  .sidebar[data-nav-open="true"] {
    transform: translateX(0);
  }
  .sidebar-inner { height: 100%; }
  .nav { overflow: auto; }
  .sidebar-footer { margin-top: 1.25rem; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr 1fr; }
  .nav-toggle { display: inline-flex; }
}
.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1rem;
}
.settings-tabs a {
  background: rgba(255,255,255,.75);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .45rem .9rem;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
}
.settings-tabs a:hover { background: #fff; text-decoration: none; }
.settings-tabs a.is-active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.settings-panel { display: none; }
.settings-panel.is-open { display: block; }
.section-title {
  margin: 0 0 .85rem;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: var(--leading-tight);
}
.hint { color: var(--muted); margin: 0 0 1rem; font-size: var(--text-sm); line-height: var(--leading-relaxed); }
.form-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.form-grid-2 .span-2 { grid-column: 1 / -1; }

.site-builder {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.site-builder-preview { margin: 0 0 .25rem; }
.site-builder-list-title {
  margin: .35rem 0 0;
  font-size: 1rem;
}
.site-builder-card,
.site-builder-block {
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: .85rem 1rem;
}
.site-builder-card-head,
.site-builder-block-head {
  display: flex;
  align-items: flex-start;
  gap: .7rem;
}
.site-builder-card-head h4,
.site-builder-block-titles strong {
  margin: 0;
  font-size: 1rem;
}
.site-builder-card-head p,
.site-builder-block-titles span {
  margin: .2rem 0 0;
  color: var(--muted);
  font-size: .85rem;
  font-weight: 500;
  line-height: 1.35;
}
.site-builder-pin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line);
  flex-shrink: 0;
}
.site-builder-fields { margin-top: .85rem; }
.site-builder-blocks {
  display: flex;
  flex-direction: column;
  gap: .7rem;
}
.site-builder-block.is-off {
  opacity: .62;
  background: #f3f4f3;
}
.site-builder-block.is-dragging {
  opacity: .45;
}
.site-builder-block.is-drag-over {
  border-color: var(--teal, #187166);
  box-shadow: 0 0 0 2px rgba(24, 113, 102, .18);
}
.site-builder-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 10px;
  background: #fff;
  border: 1px dashed var(--line);
  color: var(--muted);
  cursor: grab;
  user-select: none;
  letter-spacing: -.15em;
  font-size: 1rem;
  flex-shrink: 0;
  touch-action: none;
}
.site-builder-handle:active { cursor: grabbing; }
.site-builder-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.6rem;
  height: 1.6rem;
  margin-top: .2rem;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  flex-shrink: 0;
}
.site-builder-block-titles { flex: 1; min-width: 0; }
.site-builder-block-tools {
  display: flex;
  align-items: center;
  gap: .35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.site-builder-move {
  width: 2rem;
  height: 2rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}
.site-builder-move:disabled {
  opacity: .35;
  cursor: default;
}
.site-builder-show { margin: 0; white-space: nowrap; }
.site-builder-details {
  margin-top: .65rem;
  border-top: 1px solid var(--line);
  padding-top: .45rem;
}
.site-builder-details summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--ink);
  padding: .2rem 0;
}
@media (max-width: 720px) {
  .site-builder-block-head {
    flex-wrap: wrap;
  }
  .site-builder-block-tools {
    width: 100%;
    justify-content: flex-start;
    padding-left: 2.7rem;
  }
}
label.check {
  display: flex;
  align-items: center;
  gap: .55rem;
  font-weight: 600;
}
label.check input { width: auto; }
.user-edit {
  background: #f8fbfa;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: .9rem;
}

.committee-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
  margin-bottom: 1.1rem;
}
.committee-tab {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  background: rgba(255,255,255,.8);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .45rem .9rem;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}
.committee-tab:hover { background: #fff; text-decoration: none; }
.committee-tab.is-active {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}
.committee-tab-count {
  font-size: .78rem;
  opacity: .85;
  background: rgba(0,0,0,.08);
  border-radius: 999px;
  padding: .05rem .45rem;
}
.committee-tab.is-active .committee-tab-count {
  background: rgba(255,255,255,.2);
}
.btn-plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 50%;
  background: var(--coral);
  color: #fff;
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
}
.btn-plus:hover {
  background: #c9684f;
  text-decoration: none;
  color: #fff;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1rem;
}
.side-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .4rem;
}
.side-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  padding: .7rem .85rem;
  border-radius: 12px;
  border: 1px solid transparent;
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  background: #f7fbf9;
}
.side-list-item:hover {
  background: #eef7f3;
  text-decoration: none;
}
.side-list-item.is-active {
  background: rgba(13, 115, 119, .12);
  border-color: rgba(13, 115, 119, .28);
  color: var(--teal-dark);
}
.side-list-count {
  font-size: .8rem;
  color: var(--muted);
  background: rgba(255,255,255,.8);
  border-radius: 999px;
  padding: .1rem .5rem;
}
.side-list-empty {
  color: var(--muted);
  padding: .5rem 0;
}
.member-chips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .65rem;
}
.member-chip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  padding: .75rem .9rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfdfc;
}
.member-chip-main {
  display: flex;
  align-items: center;
  gap: .55rem;
  flex-wrap: wrap;
}
.member-chip-actions {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin: 0;
}

.cal-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.cal-head {
  background: #e8f2ef;
  padding: .55rem .4rem;
  text-align: center;
  font-weight: 700;
  font-size: .85rem;
  color: var(--muted);
}
.cal-cell {
  background: #fff;
  min-height: 110px;
  padding: .4rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.cal-cell.is-out { background: #f5f8f7; opacity: .72; }
.cal-cell.is-today { box-shadow: inset 0 0 0 2px rgba(13,115,119,.35); }
.cal-daynum {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: .9rem;
}
.cal-add {
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(224,122,95,.12);
  color: var(--coral);
  font-weight: 700;
  text-decoration: none;
  line-height: 1;
}
.cal-add:hover { background: var(--coral); color: #fff; text-decoration: none; }
.cal-items { display: grid; gap: .25rem; }
.cal-item {
  display: block;
  font-size: .75rem;
  font-weight: 600;
  padding: .2rem .35rem;
  border-radius: 7px;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
}
.cal-item:hover { text-decoration: none; filter: brightness(.96); }
.cal-item-time { opacity: .7; margin-right: .2rem; }
.cal-item.kind-event { background: #d8f3ef; color: #0f6b63; }
.cal-item.kind-meeting { background: #ffe8df; color: #8a3d28; }
.cal-item.kind-other { background: #eef2f1; color: #4d5f5a; }
.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .85rem;
}
.cal-legend .cal-item { cursor: default; }

@media (max-width: 900px) {
  .cal-cell { min-height: 84px; }
  .cal-item-time { display: none; }
}

@media (max-width: 640px) {
  .grid-4, .grid-3, .grid-2, .form-grid-2 { grid-template-columns: 1fr; }
  .event-result-row { grid-template-columns: 1fr !important; }
  .main { padding: 1rem; }
  .portal-body.portal-app .portal-app-frame {
    max-width: 100%;
    box-shadow: none;
  }
  .portal-body.portal-app .portal-tabbar,
  .portal-body.portal-app .portal-more-sheet,
  .portal-body.portal-app .portal-guest-bar,
  .portal-body.portal-app .portal-more-backdrop {
    width: 100%;
    left: 0;
    transform: none;
  }
  .portal-body:not(.portal-app) .portal-nav-wrap {
    display: grid;
    grid-template-rows: 0fr;
    overflow: hidden;
    margin-top: .75rem;
    padding-top: 0;
    border-top: 0;
    transition: grid-template-rows .24s ease, padding .24s ease, border-color .24s ease;
  }
  .portal-body:not(.portal-app) .portal-nav-wrap[data-nav-open="true"] {
    grid-template-rows: 1fr;
    padding-top: .85rem;
    border-top: 1px solid rgba(13,115,119,.08);
  }
  .portal-body:not(.portal-app) .portal-nav-wrap > * { min-height: 0; }
  .portal-body:not(.portal-app) .portal-nav,
  .portal-body:not(.portal-app) .portal-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .portal-body:not(.portal-app) .portal-nav a,
  .portal-body:not(.portal-app) .portal-actions form,
  .portal-body:not(.portal-app) .portal-actions .btn {
    width: 100%;
  }
  .portal-body:not(.portal-app) .portal-nav-toggle {
    display: inline-flex;
  }
  .portal-stat .stat-value { font-size: var(--text-xl); }
}

/* Portal contact / feedback */
.portal-article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem .55rem;
  align-items: center;
  margin-bottom: .45rem;
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: .18rem .55rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
  background: rgba(13, 115, 119, .12);
  color: var(--teal-dark);
}
.badge-muted {
  background: rgba(92, 114, 108, .12);
  color: var(--muted);
}
.badge-status-new { background: rgba(224, 122, 95, .18); color: #9a3f2a; }
.badge-status-in_progress { background: rgba(233, 196, 106, .28); color: #7a5b12; }
.badge-status-resolved { background: rgba(42, 157, 143, .18); color: #1a6b61; }
.badge-status-closed { background: rgba(26, 46, 42, .1); color: var(--muted); }
.portal-stack { display: grid; gap: .85rem; }
.portal-article {
  padding: .85rem 0;
  border-bottom: 1px solid var(--line);
}
.portal-article:last-child { border-bottom: 0; padding-bottom: 0; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) {
  .form-grid-3 { grid-template-columns: 1fr; }
}

.child-card-head {
  display: flex;
  align-items: center;
  gap: .95rem;
}
.child-avatar {
  flex-shrink: 0;
  width: 3rem;
  height: 3rem;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: #f7fffe;
  background: linear-gradient(145deg, #0f7f83, #0a5558);
  box-shadow: 0 10px 20px rgba(13,115,119,.2);
}
.child-card {
  padding: 1.2rem 1.25rem;
}



/* Language switcher + RTL portal */
.portal-header-tools {
  display: flex;
  align-items: center;
  gap: .55rem;
}
.lang-switch select {
  appearance: none;
  border: 1px solid rgba(13,115,119,.16);
  background: rgba(255,255,255,.72);
  color: var(--ink);
  border-radius: 999px;
  padding: .4rem 1rem;
  font: inherit;
  font-size: .84rem;
  font-weight: 650;
  cursor: pointer;
}
.lang-switch-auth {
  display: flex;
  justify-content: flex-end;
  margin-bottom: .75rem;
}
.lang-switch-auth select {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: .35rem .85rem;
  font: inherit;
}
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
body.is-rtl,
html[dir="rtl"] body.portal-body {
  direction: rtl;
}
html[dir="rtl"] .portal-brand-row,
html[dir="rtl"] .portal-header-tools,
html[dir="rtl"] .topbar,
html[dir="rtl"] .child-card-head,
html[dir="rtl"] .portal-article-meta,
html[dir="rtl"] .portal-actions {
  flex-direction: row-reverse;
}
html[dir="rtl"] .portal-nav,
html[dir="rtl"] .form-grid,
html[dir="rtl"] table {
  text-align: right;
}
.portal-rise {
  animation: portalRise .45s ease both;
}
@keyframes portalRise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg-thread {
  display: grid;
  gap: .55rem;
  margin-top: .85rem;
  padding-top: .75rem;
  border-top: 1px solid var(--line);
}
.msg-bubble {
  padding: .7rem .85rem;
  border-radius: 14px;
  background: #f4f8f7;
  border: 1px solid rgba(13,115,119,.08);
}
.msg-bubble p { margin: .35rem 0 0; }
.msg-bubble-meta {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  align-items: baseline;
  font-size: .82rem;
}
.msg-bubble-admin {
  background: rgba(13,115,119,.08);
  border-color: rgba(13,115,119,.14);
}
.msg-bubble-parent {
  background: #fff;
}
.msg-reply-form {
  display: grid;
  gap: .45rem;
  margin-top: .75rem;
}
.msg-reply-form textarea {
  width: 100%;
  min-height: 2.8rem;
}
.btn-sm {
  padding: .32rem .65rem;
  font-size: var(--text-xs);
  width: fit-content;
}
.portal-more-push {
  display: flex;
  align-items: center;
  gap: .7rem;
  width: 100%;
  padding: .8rem .85rem;
  border: 0;
  border-radius: 14px;
  color: var(--ink);
  font-weight: 650;
  text-align: start;
  background: #f4f8f7;
  cursor: pointer;
}
.portal-more-push:hover { background: #eaf4f2; }
.portal-push-btn.is-push-on,
.portal-more-push.is-push-on {
  color: #0a5558;
  border-color: rgba(13,115,119,.28);
}
.portal-push-btn:not(.is-push-on):not([disabled]),
.portal-more-push:not(.is-push-on):not([disabled]) {
  background: rgba(13,115,119,.12);
  border-color: rgba(13,115,119,.22);
  font-weight: 700;
}
.sr-only,
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Admin inbox + conversation */
.inbox-filters { margin-bottom: 1rem; }
.inbox-list {
  padding: 0;
  overflow: hidden;
}
.inbox-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .95rem 1.05rem;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid var(--line);
  transition: background .15s ease;
}
.inbox-row:last-child { border-bottom: 0; }
.inbox-row:hover { background: rgba(13,115,119,.05); text-decoration: none; }
.inbox-row.is-unread {
  background: rgba(224,122,95,.07);
}
.inbox-row.is-unread .inbox-subject { font-weight: 750; }
.inbox-row-main { flex: 1; min-width: 0; }
.inbox-row-top {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  align-items: baseline;
}
.inbox-from { font-size: .98rem; }
.inbox-when { font-size: .78rem; white-space: nowrap; }
.inbox-subject {
  margin-top: .2rem;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
}
.inbox-preview {
  margin-top: .2rem;
  font-size: .88rem;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inbox-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-top: .45rem;
}
.inbox-chevron {
  font-size: 1.4rem;
  color: var(--muted);
  line-height: 1;
}
.msg-conversation {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}
.msg-conversation-side { position: sticky; top: 1rem; }
.msg-side-facts {
  display: grid;
  gap: .55rem;
  margin: 0 0 1rem;
}
.msg-side-facts > div {
  display: grid;
  gap: .1rem;
}
.msg-side-facts dt {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  font-weight: 700;
}
.msg-side-facts dd { margin: 0; }
.msg-status-form { gap: .65rem; }
.msg-conversation-main {
  display: flex;
  flex-direction: column;
  min-height: min(70vh, 720px);
  padding: 0;
  overflow: hidden;
}
.msg-thread-full {
  margin: 0;
  padding: 1rem;
  border: 0;
  flex: 1;
  overflow: auto;
  max-height: min(55vh, 560px);
  background:
    linear-gradient(180deg, rgba(244,248,247,.65), rgba(255,255,255,0) 40%);
}
.msg-composer {
  display: grid;
  gap: .65rem;
  padding: .9rem 1rem 1rem;
  border-top: 1px solid var(--line);
  background: #fff;
}
.msg-composer textarea {
  width: 100%;
  resize: vertical;
  min-height: 4.5rem;
}
@media (max-width: 860px) {
  .msg-conversation {
    grid-template-columns: 1fr;
  }
  .msg-conversation-side { position: static; }
  .msg-thread-full { max-height: 50vh; }
}

.members-fab {
  display: none;
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  z-index: 40;
  width: 3.4rem;
  height: 3.4rem;
  border-radius: 999px;
  background: #0d7377;
  color: #fff;
  font-size: 1.8rem;
  line-height: 3.4rem;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 12px 28px rgba(13,115,119,.35);
}
.members-fab:hover { color: #fff; text-decoration: none; filter: brightness(1.05); }
.members-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .85rem;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.members-search {
  display: flex;
  gap: .5rem;
  flex: 1;
  min-width: 220px;
}
.members-search input { flex: 1; }
.members-list-card { padding: 0; overflow: hidden; }
.members-table td, .members-table th { vertical-align: top; }
.members-name-link { color: inherit; text-decoration: none; }
.members-name-link:hover { color: #0d7377; text-decoration: underline; }
.members-row-actions {
  white-space: nowrap;
  display: flex;
  gap: .35rem;
  flex-wrap: wrap;
}
.member-dossier { display: grid; gap: 1rem; }
.member-print-block-head {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: .65rem;
}
.member-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .65rem 1rem;
  margin: 0;
}
.member-facts > div { display: grid; gap: .12rem; }
.member-facts .span-2 { grid-column: 1 / -1; }
.member-facts dt {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  font-weight: 700;
}
.member-facts dd { margin: 0; }
.member-parents-list { margin: .35rem 0 0; padding-left: 1.1rem; }
.member-child-tools {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin-top: .85rem;
}
.member-print-header { display: none; }
.print-only { display: none; }

@media (max-width: 720px) {
  .members-fab { display: block; }
  .members-add-btn span { display: none; }
  .member-facts { grid-template-columns: 1fr; }
  .members-row-actions { flex-direction: column; }
}

@media print {
  .no-print,
  .sidebar,
  .app-shell > aside,
  .topbar .actions,
  .flash,
  .members-fab,
  nav.sidebar,
  .layout > aside { display: none !important; }
  body { background: #fff !important; }
  .card { break-inside: avoid; box-shadow: none !important; border: 1px solid #ccc !important; }
  .print-only, .member-print-header { display: block !important; margin-bottom: 1rem; }
  body.print-section-mode .member-print-block:not(.print-section-target),
  body.print-section-mode .no-print { display: none !important; }
  body.print-section-mode .member-print-header { display: block !important; }
}

@media (prefers-reduced-motion: reduce) {
  .portal-rise,
  .auth-hero-glow,
  .page-enter { animation: none !important; }
}

/* Portal e-shop product cards */
.shop-catalog {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.shop-product {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}
.shop-product-media {
  background: linear-gradient(160deg, #e8f3f0 0%, #f4f7f5 100%);
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
}
.shop-product-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.shop-product-placeholder {
  width: 4rem;
  height: 4rem;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: rgba(13,115,119,.12);
  color: var(--teal-dark);
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
}
.shop-product-body {
  padding: 1rem 1.05rem 1.1rem;
  display: grid;
  gap: .35rem;
}
.shop-product-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-md);
  letter-spacing: -0.02em;
  line-height: var(--leading-tight);
}
.shop-product-cat { margin: 0; font-size: var(--text-xs); }
.shop-product-desc {
  margin: .15rem 0 .25rem;
  color: var(--ink);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}
.shop-product-price {
  margin: .15rem 0;
  display: flex;
  align-items: center;
  gap: .45rem;
  flex-wrap: wrap;
}
.shop-product-form {
  margin-top: .45rem;
}
.portal-body.portal-app .shop-catalog {
  grid-template-columns: 1fr;
}

/* Admin stock: compact inventory page */
.stock-page .topbar {
  margin-bottom: .7rem;
}
.stock-page .topbar h1 {
  font-size: 1.15rem;
}
.stock-page .topbar p {
  font-size: .75rem;
}
.stock-page .card {
  padding: .85rem .95rem;
}
.stock-page .card h3 {
  font-size: .95rem;
  margin-bottom: .45rem;
  letter-spacing: 0;
}
.stock-page .form-grid {
  gap: .45rem .6rem;
}
.stock-page label {
  font-size: .72rem;
  gap: .18rem;
}
.stock-page input,
.stock-page select,
.stock-page textarea {
  font-size: .8rem;
  padding: .35rem .5rem;
  border-radius: 8px;
}
.stock-page .hint {
  font-size: .72rem;
  line-height: 1.35;
}
.stock-page .btn {
  font-size: .78rem;
  padding: .38rem .7rem;
}
.stock-page .btn-sm {
  font-size: .7rem;
  padding: .18rem .45rem;
}
.stock-page .badge {
  font-size: .62rem;
  padding: .08rem .35rem;
}

/* Admin stock inventory list */
.stock-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
}
.stock-list-item {
  border-bottom: 1px solid var(--line);
  padding: .38rem 0;
}
.stock-list-item:first-child { padding-top: 0; }
.stock-list-item:last-child { border-bottom: 0; padding-bottom: 0; }
.stock-list-item.is-low {
  background: rgba(224, 122, 95, .04);
  margin: 0 -.5rem;
  padding-left: .5rem;
  padding-right: .5rem;
  border-radius: 10px;
}
.stock-list-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(90px, .7fr) minmax(80px, .6fr);
  gap: .3rem .65rem;
  align-items: center;
}
.stock-list-row.stock-list-has-actions {
  grid-template-columns: minmax(0, 1.4fr) minmax(90px, .7fr) minmax(80px, .6fr) auto;
}
.stock-list-head {
  padding-bottom: .3rem;
  margin-bottom: .1rem;
  border-bottom: 1px solid var(--line);
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  font-weight: 650;
}
.stock-list-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .2rem .35rem;
  min-width: 0;
}
.stock-list-name strong {
  font-family: var(--font-ui);
  font-size: .8125rem;
  font-weight: 650;
  letter-spacing: 0;
  line-height: 1.25;
}
.stock-list-qty,
.stock-list-price {
  text-align: right;
}
.stock-list-qty strong,
.stock-list-price strong {
  font-size: .8125rem;
  font-weight: 650;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}
.stock-list-actions {
  text-align: right;
}
.stock-item-edit-panel {
  margin-top: .45rem;
  padding: .55rem .65rem;
  background: #f7fbf9;
  border: 1px solid var(--line);
  border-radius: 8px;
}
@media (max-width: 640px) {
  .stock-list-head { display: none; }
  .stock-list-row {
    grid-template-columns: 1fr auto;
    gap: .45rem .65rem;
  }
  .stock-list-name { grid-column: 1 / -1; }
  .stock-list-qty,
  .stock-list-price {
    text-align: left;
  }
  .stock-list-actions {
    grid-column: 2;
    grid-row: 2 / span 2;
    align-self: start;
  }
}

/* Unified headings & text utilities */
.card h3,
.card > h3:first-child {
  margin-top: 0;
  margin-bottom: .85rem;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: var(--leading-tight);
}
.card h4 {
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: var(--leading-tight);
}
.muted,
.text-muted {
  color: var(--muted);
  font-size: var(--text-sm);
}
input,
select,
textarea,
button {
  font-family: inherit;
  font-size: var(--text-sm);
}
td {
  font-size: var(--text-sm);
}
pre,
code {
  font-family: ui-monospace, "Cascadia Code", "Segoe UI Mono", monospace;
  font-size: var(--text-xs);
}

/* Treasury fixed items — monthly view */
.fixed-month-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}
.fixed-month-nav {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.fixed-month-label {
  min-width: 9rem;
  text-align: center;
  font-family: var(--font-display);
  font-size: var(--text-md);
}
.fixed-month-table tr.is-inactive {
  opacity: .65;
}
.fixed-post-inline {
  display: flex;
  align-items: center;
  gap: .35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.fixed-post-inline input[type="password"] {
  padding: .35rem .5rem;
  font-size: var(--text-xs);
}
.treasury-filter-panel[hidden] {
  display: none;
}
.treasury-filter-card {
  padding-top: .85rem;
  padding-bottom: .85rem;
}
@media (max-width: 720px) {
  .fixed-post-inline {
    justify-content: flex-start;
  }
  .fixed-month-table th:nth-child(2),
  .fixed-month-table td:nth-child(2) {
    display: none;
  }
}

/* Event organization */
.event-tabs {
  display: flex;
  gap: .35rem;
  flex-wrap: wrap;
  margin: 0 0 1rem;
  padding: .25rem;
  background: var(--color-neutral-50, #f4f6f8);
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
}
.event-tabs a {
  padding: .55rem 1rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  font-size: var(--text-sm);
}
.event-tabs a.is-active,
.event-tabs a:hover {
  background: var(--card, #fff);
  color: var(--ink, #0f172a);
  box-shadow: var(--shadow-sm);
}
.progress-track {
  height: 10px;
  background: #e8eef0;
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--teal, #0d7377);
  border-radius: 999px;
  transition: width .25s ease;
}
.progress-fill.is-danger {
  background: var(--danger);
}
.event-people-list,
.event-task-list {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  gap: .55rem;
}
.event-people-list li,
.event-task-list li {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  padding: .65rem .75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--color-neutral-25, #fafbfc);
}
.event-task-list li.is-done {
  opacity: .72;
}
.event-task-list li.is-done strong {
  text-decoration: line-through;
}
.event-task-list li.is-overdue {
  border-color: color-mix(in srgb, var(--danger) 45%, var(--line));
}
.event-task-toggle {
  margin: 0;
}
.event-task-check {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: .4rem;
  border: 1.5px solid var(--line);
  background: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--ok);
  flex-shrink: 0;
}
.event-task-list li.is-done .event-task-check {
  background: color-mix(in srgb, var(--ok) 18%, #fff);
  border-color: var(--ok);
}
.event-task-body {
  flex: 1;
  min-width: 0;
}
.event-note {
  padding: .85rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--color-neutral-25, #fafbfc);
}
.event-note-head {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  align-items: flex-start;
}

.meeting-agenda-list {
  margin: 0 0 1rem;
  padding-left: 1.2rem;
}
.meeting-agenda-list li {
  margin-bottom: 0.55rem;
}
.meeting-agenda-create-row + .meeting-agenda-create-row {
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px dashed var(--line);
}

/* Dashboard */
.dashboard-page {
  display: block;
  padding-inline-end: 5.6rem;
}
.dashboard-page.is-actions-empty {
  padding-inline-end: 0;
}
.dashboard-actions {
  position: fixed;
  right: max(.9rem, env(safe-area-inset-right, 0px));
  bottom: max(1.35rem, env(safe-area-inset-bottom, 0px));
  z-index: 80;
  display: flex;
  flex-direction: row-reverse;
  align-items: flex-end;
  gap: .7rem;
  min-width: 0;
  pointer-events: none;
}
.dashboard-actions-btn,
.dashboard-actions-panel {
  pointer-events: auto;
}
.dashboard-actions-btn {
  position: relative;
  isolation: isolate;
  flex: 0 0 4.7rem;
  width: 4.7rem;
  height: 4.7rem;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .12rem;
  border: 0;
  background: var(--teal);
  color: #fff;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: .62rem;
  letter-spacing: .02em;
  line-height: 1.1;
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(16, 62, 63, .22);
  transition: transform 180ms var(--ease-emphasized, cubic-bezier(.2, 0, 0, 1.1)),
              box-shadow 180ms var(--ease-standard, ease),
              background-color 160ms ease;
}
.dashboard-actions-btn::before,
.dashboard-actions-btn::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px solid var(--teal);
  pointer-events: none;
  z-index: -1;
  opacity: 0;
}
.dashboard-actions-btn::before {
  animation: dash-fab-pulse 2.2s ease-out infinite;
}
.dashboard-actions-btn::after {
  animation: dash-fab-pulse 2.2s ease-out .7s infinite;
}
.dashboard-actions-btn:hover {
  transform: translateY(-3px) scale(1.07);
  box-shadow: 0 14px 28px rgba(16, 62, 63, .3);
}
.dashboard-actions-btn:active {
  transform: scale(.92);
}
.dashboard-actions-btn[aria-expanded="true"] {
  background: var(--teal-dark, #0f5f5a);
}
.dashboard-actions-btn[aria-expanded="true"]::before,
.dashboard-actions-btn[aria-expanded="true"]::after {
  animation: none;
  opacity: 0;
}
.dashboard-actions-btn[aria-expanded="true"] .dashboard-actions-btn-icon {
  transform: rotate(45deg);
}
.dashboard-actions-btn-icon {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
  transition: transform 220ms var(--ease-emphasized, cubic-bezier(.2, 0, 0, 1.1));
}
.dashboard-actions-btn-label {
  max-width: 3.8rem;
  text-align: center;
}
.dashboard-actions-panel {
  width: min(20rem, calc(100vw - 7.2rem));
  max-height: min(70vh, calc(100vh - 7.5rem));
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 16px 40px rgba(16, 62, 63, .16);
  padding: .85rem .9rem;
  overflow: auto;
  opacity: 0;
  transform: translateX(18px) scale(.96);
  pointer-events: none;
  transform-origin: right bottom;
  transition: opacity 200ms var(--ease-standard, ease),
              transform 240ms var(--ease-emphasized, cubic-bezier(.2, 0, 0, 1.1));
}
.dashboard-page.is-actions-open .dashboard-actions-panel {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.dashboard-quick-list .quick-action {
  opacity: 0;
  transform: translateX(12px);
}
.dashboard-page.is-actions-open .dashboard-quick-list .quick-action {
  animation: dash-action-in 280ms var(--ease-emphasized, cubic-bezier(.2, 0, 0, 1.1)) forwards;
}
.dashboard-page.is-actions-open .dashboard-quick-list .quick-action:nth-child(1) { animation-delay: 40ms; }
.dashboard-page.is-actions-open .dashboard-quick-list .quick-action:nth-child(2) { animation-delay: 70ms; }
.dashboard-page.is-actions-open .dashboard-quick-list .quick-action:nth-child(3) { animation-delay: 100ms; }
.dashboard-page.is-actions-open .dashboard-quick-list .quick-action:nth-child(4) { animation-delay: 130ms; }
.dashboard-page.is-actions-open .dashboard-quick-list .quick-action:nth-child(5) { animation-delay: 160ms; }
.dashboard-page.is-actions-open .dashboard-quick-list .quick-action:nth-child(6) { animation-delay: 190ms; }
.dashboard-page.is-actions-open .dashboard-quick-list .quick-action:nth-child(7) { animation-delay: 220ms; }
.dashboard-page.is-actions-open .dashboard-quick-list .quick-action:nth-child(8) { animation-delay: 250ms; }
.dashboard-page.is-actions-open .dashboard-quick-list .quick-action:nth-child(9) { animation-delay: 280ms; }
.dashboard-page.is-actions-open .dashboard-quick-list .quick-action:nth-child(n+10) { animation-delay: 310ms; }

@keyframes dash-fab-pulse {
  0% { transform: scale(1); opacity: .4; }
  100% { transform: scale(1.35); opacity: 0; }
}
@keyframes dash-action-in {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .dashboard-actions-btn::before,
  .dashboard-actions-btn::after,
  .dashboard-page.is-actions-open .dashboard-quick-list .quick-action {
    animation: none;
  }
  .dashboard-actions-btn,
  .dashboard-actions-btn-icon,
  .dashboard-actions-btn-label,
  .dashboard-actions-panel,
  .dashboard-quick-list .quick-action {
    transition: none;
  }
  .dashboard-page.is-actions-open .dashboard-quick-list .quick-action {
    opacity: 1;
    transform: none;
  }
}
.dashboard-quick-list {
  grid-template-columns: 1fr;
  margin-top: 0;
  gap: .5rem;
}
.dashboard-quick-list .quick-action {
  padding: .65rem .75rem;
}
.dashboard-quick-list .quick-action-body strong {
  font-size: .92rem;
}
.dash-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10.8rem, 1fr));
  gap: .7rem;
  margin-bottom: 1rem;
}
.dash-stat {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: .75rem .85rem;
  text-decoration: none;
  color: inherit;
  min-height: 5.1rem;
}
a.dash-stat:hover {
  text-decoration: none;
  border-color: var(--color-primary-300, var(--teal));
  box-shadow: var(--shadow-sm, var(--shadow));
}
.dash-stat .stat-label {
  font-size: .72rem;
  line-height: 1.3;
}
.dash-stat .stat-value {
  font-size: 1.28rem;
  margin-top: .35rem;
}
.dash-stat.is-warn {
  border-color: rgba(196, 120, 70, .35);
  background: rgba(224, 122, 95, .06);
}
.dash-stat.is-accent .stat-value {
  color: var(--teal-dark, var(--teal));
}
.dashboard-panels {
  margin-top: 0;
}

@media (max-width: 980px) {
  .dashboard-page {
    padding-inline-end: 4.8rem;
  }
  .dashboard-actions-panel {
    width: min(20rem, calc(100vw - 6.4rem));
  }
}

/* Dashboard quick actions */
.dashboard-quick {
  margin-bottom: 1rem;
}
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: .75rem;
  margin-top: 1rem;
}
.quick-action {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .85rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--color-neutral-25);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out);
}
.quick-action:hover {
  border-color: var(--color-primary-300);
  box-shadow: var(--shadow-sm);
}
.quick-action-step {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--color-primary-100);
  color: var(--color-primary-700);
  font-weight: 600;
  font-size: var(--text-sm);
}
.quick-action-body {
  display: flex;
  flex-direction: column;
  gap: .15rem;
}
.quick-action-body strong {
  font-family: var(--font-display);
  font-size: var(--text-md);
}
.quick-action-body span {
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.35;
}

/* Coupons */
.coupon-scan-viewport {
  width: 100%;
  max-width: 420px;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #0f172a;
  border: 1px solid var(--line);
}
.coupon-scan-viewport video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.coupon-wallet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: .85rem;
  margin-top: 1rem;
}
.coupon-wallet-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .65rem;
  align-items: center;
  padding: .85rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  background: var(--color-neutral-50, #f8fafc);
}
.coupon-wallet-card img {
  width: 120px;
  height: 120px;
  object-fit: contain;
}
.cpn-token {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: .05em;
  margin: .25rem 0;
}
.wallet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-top: .65rem;
}
.wallet-actions .wallet-btn {
  padding: .3rem .55rem;
  font-size: .78rem;
}
.wallet-btn-apple {
  border-color: #111;
  color: #111;
}
.wallet-btn-google {
  border-color: #1a73e8;
  color: #1a73e8;
}

/* Professional coupon / raffle ticket passes */
.ticket-print-body {
  background: #e8eef0;
  min-height: 100vh;
}
.ticket-toolbar {
  max-width: 960px;
  margin: 1rem auto 0;
  padding: 0 1rem;
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}
.ticket-print-sheet {
  max-width: 960px;
  margin: 0 auto 2rem;
  padding: 1rem;
}
.ticket-print-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .85rem;
}
.ticket-print-grid--single {
  grid-template-columns: 1fr;
  max-width: 520px;
  margin-inline: auto;
}
.ticket-order-summary {
  margin-bottom: 1rem;
}
.ticket-order-title {
  margin: 0 0 .75rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
}
.ticket-pass {
  --ticket-accent: #0d7377;
  --ticket-accent-soft: #d7efef;
  position: relative;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--ticket-accent) 35%, #cbd5e1);
  border-radius: 14px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--ticket-accent) 8%, #fff) 0%, #fff 42%, #f8fafc 100%);
  box-shadow: 0 8px 24px rgba(15, 23, 42, .08);
  break-inside: avoid;
  page-break-inside: avoid;
}
.ticket-pass--coupon {
  --ticket-accent: #0d7377;
  --ticket-accent-soft: #d7efef;
}
.ticket-pass--raffle {
  --ticket-accent: #b45309;
  --ticket-accent-soft: #ffedd5;
}
.ticket-pass.is-used {
  opacity: .62;
  filter: grayscale(.25);
}
.ticket-pass.is-winner {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--ticket-accent) 55%, transparent), 0 10px 28px rgba(180, 83, 9, .18);
}
.ticket-pass-header {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  align-items: flex-start;
  padding: .85rem .95rem .55rem;
  border-bottom: 1px dashed color-mix(in srgb, var(--ticket-accent) 28%, #cbd5e1);
}
.ticket-pass-brand {
  display: flex;
  gap: .65rem;
  align-items: center;
  min-width: 0;
}
.ticket-pass-logo,
.ticket-pass-logo-fallback {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line, #e2e8f0);
  flex: 0 0 auto;
}
.ticket-pass-logo-fallback {
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ticket-accent);
  font-size: .85rem;
}
.ticket-pass-school {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.2;
  color: #0f172a;
}
.ticket-pass-assoc {
  font-size: .78rem;
  color: #64748b;
  margin-top: .1rem;
}
.ticket-pass-type {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .28rem .55rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
  background: var(--ticket-accent-soft);
  color: var(--ticket-accent);
  border: 1px solid color-mix(in srgb, var(--ticket-accent) 25%, transparent);
}
.ticket-pass-type-mark {
  font-size: .85rem;
  line-height: 1;
}
.ticket-pass-body {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .75rem;
  align-items: center;
  padding: .85rem .95rem 1rem;
}
.ticket-pass-label {
  font-size: .92rem;
  font-weight: 600;
  color: #334155;
}
.ticket-pass-number {
  margin: .35rem 0 .2rem;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2.4vw, 1.85rem);
  font-weight: 800;
  letter-spacing: .04em;
  color: #0f172a;
  line-height: 1.1;
}
.ticket-pass-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .65rem;
  font-size: .82rem;
  color: #475569;
}
.ticket-pass-badge {
  display: inline-block;
  padding: .1rem .4rem;
  border-radius: 6px;
  background: #fee2e2;
  color: #991b1b;
  font-weight: 700;
  font-size: .75rem;
}
.ticket-pass-badge--win {
  background: #ffedd5;
  color: #9a3412;
}
.ticket-pass-token {
  margin-top: .45rem;
  font-size: .75rem;
  color: #64748b;
  letter-spacing: .03em;
}
.ticket-pass-qr img {
  width: 112px;
  height: 112px;
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
  border: 1px solid var(--line, #e2e8f0);
  padding: .2rem;
}
.coupon-wallet-card.ticket-pass {
  display: block;
  padding: 0;
}
.coupon-wallet-card.ticket-pass .ticket-pass-body {
  padding-bottom: .75rem;
}
.coupon-wallet-card.ticket-pass .wallet-actions {
  padding: 0 .95rem .85rem;
}
@media (max-width: 760px) {
  .ticket-print-grid {
    grid-template-columns: 1fr;
  }
}
@media print {
  .ticket-print-body {
    background: #fff;
  }
  .no-print {
    display: none !important;
  }
  .ticket-print-sheet {
    max-width: none;
    margin: 0;
    padding: 0;
  }
  .ticket-print-grid {
    gap: 5mm;
  }
  .ticket-pass {
    box-shadow: none;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  @page {
    size: A4;
    margin: 10mm;
  }
}

/* Coupon catalog images + A4 laminate print */
.coupon-catalog-admin {
  display: grid;
  gap: .75rem;
}
.coupon-catalog-admin-item {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: .75rem;
  align-items: start;
  padding: .65rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.coupon-catalog-admin-item.is-inactive {
  opacity: .65;
}
.coupon-catalog-admin-media img,
.coupon-sell-item img,
.coupon-portal-item img,
.ticket-pass-product,
.ticket-laminate-product img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  display: block;
}
.ticket-pass-product {
  width: 64px;
  height: 64px;
  margin-bottom: .35rem;
}
.coupon-catalog-admin-placeholder,
.ticket-laminate-product-fallback {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  border: 1px dashed var(--line);
  display: grid;
  place-items: center;
  color: #0d7377;
  background: #f1f5f9;
  font-size: 1.4rem;
}
.coupon-catalog-price {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
  color: #0d7377;
}
.coupon-sell-grid,
.coupon-portal-catalog {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .75rem;
  margin-top: .75rem;
}
.coupon-sell-item,
.coupon-portal-item {
  display: grid;
  gap: .45rem;
  padding: .65rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-weight: 500;
}
.coupon-bulk-presets {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
}
.ticket-print-sheet.is-laminate {
  max-width: 210mm;
}
.ticket-laminate-grid {
  display: grid;
  gap: 0;
}
.ticket-laminate-grid--2 {
  grid-template-columns: repeat(2, 1fr);
}
.ticket-laminate-grid--3 {
  grid-template-columns: repeat(3, 1fr);
}
.ticket-laminate {
  border: 1px dashed #94a3b8;
  background: #fff;
  break-inside: avoid;
  page-break-inside: avoid;
  min-height: 48mm;
}
.ticket-laminate-inner {
  padding: 3.5mm;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 2.5mm;
  background:
    linear-gradient(135deg, rgba(13, 115, 119, .08), transparent 45%),
    #fff;
}
.ticket-laminate-top {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 2mm;
  align-items: center;
}
.ticket-laminate-logo,
.ticket-laminate-logo-fallback {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  object-fit: contain;
  background: #fff;
  border: 1px solid #e2e8f0;
}
.ticket-laminate-logo-fallback {
  display: grid;
  place-items: center;
  font-size: .45rem;
  font-weight: 800;
  color: #0d7377;
  font-family: var(--font-display);
}
.ticket-laminate-school {
  font-size: 7.5pt;
  font-weight: 700;
  line-height: 1.15;
  font-family: var(--font-display);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ticket-laminate-badge {
  font-size: 6.5pt;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #0d7377;
  background: #d7efef;
  border-radius: 999px;
  padding: .1rem .35rem;
}
.ticket-laminate-mid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2.5mm;
  align-items: center;
  flex: 1;
}
.ticket-laminate-product {
  display: grid;
  grid-template-columns: 22mm 1fr;
  gap: 2.5mm;
  align-items: center;
  min-width: 0;
}
.ticket-laminate-product img,
.ticket-laminate-product-fallback {
  width: 22mm;
  height: 22mm;
  border-radius: 6px;
}
.ticket-laminate-product-fallback {
  font-size: 1rem;
}
.ticket-laminate-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 11pt;
  line-height: 1.15;
}
.ticket-laminate-price {
  margin-top: 1mm;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 14pt;
  color: #0d7377;
}
.ticket-laminate-qr img {
  width: 22mm;
  height: 22mm;
  object-fit: contain;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: .5mm;
}
.ticket-laminate-bottom {
  display: flex;
  justify-content: space-between;
  gap: 2mm;
  align-items: baseline;
  border-top: 1px dashed #cbd5e1;
  padding-top: 1.5mm;
  font-size: 7.5pt;
}
.ticket-laminate-bottom strong {
  font-family: var(--font-display);
  font-size: 9pt;
  letter-spacing: .03em;
}
.ticket-laminate-bottom span {
  color: #64748b;
  font-family: var(--font-display);
  letter-spacing: .03em;
}
@media print {
  .ticket-print-sheet.is-laminate {
    max-width: none;
    padding: 0;
    margin: 0;
  }
  .ticket-laminate-grid--2 .ticket-laminate {
    min-height: 52mm;
  }
  .ticket-laminate-grid--3 .ticket-laminate {
    min-height: 45mm;
  }
  @page {
    size: A4;
    margin: 6mm;
  }
}

/* Year budget page */
.budget-page {
  max-width: 72rem;
}
.budget-topbar-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  align-items: center;
}
.budget-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding: 1.25rem 1.35rem;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--teal, #0d7377) 8%, var(--card, #fff)) 0%, var(--card, #fff) 55%),
    var(--card, #fff);
  border-color: color-mix(in srgb, var(--teal, #0d7377) 22%, var(--line));
}
.budget-hero-kicker {
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--teal-dark, var(--teal));
  margin-bottom: .5rem;
}
.budget-hero-net {
  display: flex;
  align-items: stretch;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.budget-hero-net-item {
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.budget-hero-net-item strong {
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 3vw, 2rem);
  line-height: 1.15;
}
.budget-hero-label {
  font-size: .82rem;
  color: var(--muted);
}
.budget-hero-divider {
  width: 1px;
  align-self: stretch;
  background: var(--line);
  min-height: 2.5rem;
}
.budget-hero-variance {
  margin: .75rem 0 0;
}
.is-positive { color: var(--ok, #2a7a62); }
.is-negative { color: var(--danger, #c45c4a); }
.budget-hero-tools {
  display: flex;
  flex-direction: column;
  gap: .65rem;
  align-items: stretch;
  min-width: min(100%, 14rem);
}
.budget-year-form label {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  margin: 0;
}
.budget-year-form-label {
  font-size: .75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .03em;
}
.budget-year-form select {
  min-width: 9rem;
}
.budget-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .75rem;
  margin-bottom: 1rem;
}
@media (max-width: 900px) {
  .budget-kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .budget-kpi-grid { grid-template-columns: 1fr; }
}
.budget-kpi {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .9rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow-sm, var(--shadow));
}
.budget-kpi-icon {
  flex-shrink: 0;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: .65rem;
  display: grid;
  place-items: center;
}
.budget-kpi-icon svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.budget-kpi.is-income .budget-kpi-icon {
  background: color-mix(in srgb, var(--ok) 16%, #fff);
  color: var(--ok);
}
.budget-kpi.is-income-soft .budget-kpi-icon {
  background: color-mix(in srgb, var(--ok) 10%, #fff);
  color: color-mix(in srgb, var(--ok) 80%, #333);
}
.budget-kpi.is-expense .budget-kpi-icon {
  background: color-mix(in srgb, var(--danger) 14%, #fff);
  color: var(--danger);
}
.budget-kpi.is-expense-soft .budget-kpi-icon {
  background: color-mix(in srgb, var(--coral, #e07a5f) 12%, #fff);
  color: var(--coral, #c45c4a);
}
.budget-kpi-label {
  font-size: .72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .02em;
}
.budget-kpi-value {
  font-family: var(--font-display);
  font-size: 1.22rem;
  margin-top: .15rem;
  line-height: 1.2;
}
.budget-kpi-sub {
  font-size: .78rem;
  color: var(--muted);
  margin-top: .2rem;
}
.budget-columns {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  align-items: start;
}
@media (max-width: 980px) {
  .budget-columns { grid-template-columns: 1fr; }
}
.budget-panel {
  padding: 0;
  overflow: hidden;
}
.budget-panel.is-income-panel {
  border-top: 3px solid var(--ok);
}
.budget-panel.is-expense-panel {
  border-top: 3px solid var(--danger);
}
.budget-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .75rem;
  padding: 1rem 1.1rem .75rem;
  border-bottom: 1px solid var(--line);
  background: var(--color-neutral-25, #fafbfc);
}
.budget-panel-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
}
.budget-panel-head .hint {
  margin: .25rem 0 0;
  font-size: .82rem;
}
.budget-panel-totals {
  font-size: .88rem;
  color: var(--muted);
  white-space: nowrap;
  text-align: right;
}
.budget-panel-totals strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.05rem;
}
.budget-panel-totals-sep {
  margin: 0 .25rem;
  opacity: .5;
}
.budget-panel-empty {
  padding: 1rem 1.1rem;
  margin: 0;
}
.budget-lines {
  list-style: none;
  margin: 0;
  padding: 0;
}
.budget-line {
  padding: .85rem 1.1rem;
  border-bottom: 1px solid var(--line);
}
.budget-line:last-child {
  border-bottom: none;
}
.budget-line-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .75rem;
  margin-bottom: .35rem;
}
.budget-line-cat {
  font-family: var(--font-display);
  font-size: .98rem;
}
.budget-line-variance {
  font-size: .82rem;
  font-weight: 700;
  padding: .12rem .45rem;
  border-radius: 999px;
  background: var(--color-neutral-50, #f1f5f5);
}
.budget-line-variance.is-good {
  color: var(--ok);
  background: color-mix(in srgb, var(--ok) 12%, #fff);
}
.budget-line-variance.is-bad {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, #fff);
}
.budget-line-variance.is-neutral {
  color: var(--muted);
}
.budget-line-amounts {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  font-size: .82rem;
  color: var(--muted);
  margin-bottom: .45rem;
}
.budget-line-amounts strong {
  color: var(--ink);
}
.budget-line-progress {
  margin-bottom: .35rem;
}
.budget-line-edit {
  margin-top: .15rem;
}
.budget-line-edit summary {
  cursor: pointer;
  font-size: .78rem;
  font-weight: 600;
  color: var(--teal-dark, var(--teal));
  list-style: none;
  user-select: none;
}
.budget-line-edit summary::-webkit-details-marker { display: none; }
.budget-line-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .5rem;
  margin-top: .55rem;
  padding-top: .55rem;
  border-top: 1px dashed var(--line);
}
.budget-line-form label {
  margin: 0;
  font-size: .78rem;
}
.budget-line-form-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
}
.budget-add-form {
  display: grid;
  grid-template-columns: 1fr 5.5rem auto;
  gap: .5rem;
  align-items: end;
  padding: .85rem 1.1rem;
  background: var(--color-neutral-25, #fafbfc);
  border-top: 1px solid var(--line);
}
.budget-add-form label { margin: 0; }
.budget-add-form input[type="number"] { text-align: right; }
.budget-footnote {
  margin-top: 1rem;
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--color-neutral-25, #fafbfc);
  border: 1px solid var(--line);
}
@media (max-width: 640px) {
  .budget-hero-divider { display: none; }
  .budget-line-amounts { flex-direction: column; gap: .15rem; }
  .budget-add-form {
    grid-template-columns: 1fr 1fr;
  }
  .budget-add-form button {
    grid-column: 1 / -1;
  }
  .budget-line-form {
    grid-template-columns: 1fr;
  }
}


