/* ==========================================================================
   School Fees Portal — design system
   ========================================================================== */

:root {
  --ink: #14251f;
  --ink-2: #47584f;
  --ink-3: #74827a;
  --ink-4: #9aa69e;
  --green-950: #08251b;
  --green-900: #0b2e22;
  --green-800: #0f3d2e;
  --green-700: #155b43;
  --green-600: #1b7757;
  --green-500: #238d68;
  --green-100: #e2efe8;
  --green-50: #f0f7f3;
  --amber-700: #a3630c;
  --amber-600: #c07a18;
  --amber-100: #faeed7;
  --red-700: #a33a33;
  --red-100: #fbe8e6;
  --blue-700: #2a5c86;
  --blue-100: #e6eff7;
  --cream: #f6f4ee;
  --cream-2: #efecE2;
  --paper: #ffffff;
  --line: #e5e2d7;
  --line-strong: #d2cebf;
  --radius-lg: 18px;
  --radius: 13px;
  --radius-sm: 9px;
  --shadow-xs: 0 1px 2px rgba(20, 37, 31, 0.05);
  --shadow-sm: 0 1px 2px rgba(20, 37, 31, 0.05), 0 4px 14px -8px rgba(20, 37, 31, 0.18);
  --shadow-md: 0 18px 44px -22px rgba(11, 46, 34, 0.42);
  --shadow-lg: 0 30px 70px -30px rgba(8, 37, 27, 0.5);
  --font-serif: Georgia, "Times New Roman", "Iowan Old Style", serif;
  --font-sans: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
  --font-mono: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  --sidebar-width: 266px;
  --topbar-height: 66px;
}

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

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.18;
  color: var(--ink);
}

h1 {
  font-size: clamp(2rem, 4.4vw, 3.35rem);
}
h2 {
  font-size: clamp(1.35rem, 2.2vw, 1.7rem);
}
h3 {
  font-size: 1.12rem;
}
h4 {
  font-size: 0.98rem;
}

p {
  margin: 0;
}

a {
  color: var(--green-700);
  text-decoration: none;
}
a:hover {
  color: var(--green-600);
  text-decoration: underline;
  text-underline-offset: 3px;
}

button {
  font-family: inherit;
}

img,
svg {
  display: block;
}

::selection {
  background: var(--green-100);
}

:focus-visible {
  outline: 2px solid var(--green-600);
  outline-offset: 2px;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 19px;
  height: 19px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-sm {
  width: 15px;
  height: 15px;
}

.icon-lg {
  width: 24px;
  height: 24px;
}

/* ---------- buttons ---------- */

.btn {
  --btn-bg: var(--green-800);
  --btn-fg: #f4f8f5;
  --btn-border: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 10px 18px;
  min-height: 42px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease, color 0.14s ease;
  white-space: nowrap;
  text-decoration: none;
}

.btn:hover {
  background: var(--green-700);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 10px 20px -14px rgba(11, 46, 34, 0.7);
}

.btn:active {
  transform: translateY(1px);
}

.btn[disabled],
.btn.is-busy {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  --btn-bg: transparent;
  --btn-fg: var(--ink);
  --btn-border: var(--line-strong);
}
.btn-secondary:hover {
  background: rgba(15, 61, 46, 0.06);
  color: var(--green-800);
  border-color: var(--green-600);
}

.btn-ghost {
  --btn-bg: transparent;
  --btn-fg: var(--ink-2);
  --btn-border: transparent;
  padding-inline: 12px;
}
.btn-ghost:hover {
  background: rgba(15, 61, 46, 0.07);
  color: var(--green-800);
  box-shadow: none;
}

.btn-light {
  --btn-bg: rgba(255, 255, 255, 0.12);
  --btn-fg: #f4f8f5;
  --btn-border: rgba(255, 255, 255, 0.35);
}
.btn-light:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.btn-white {
  --btn-bg: #fff;
  --btn-fg: var(--green-900);
  --btn-border: transparent;
}
.btn-white:hover {
  background: var(--green-50);
  color: var(--green-900);
}

.btn-danger {
  --btn-bg: var(--red-700);
  --btn-fg: #fff;
}
.btn-danger:hover {
  background: #8d2f29;
}

.btn-sm {
  min-height: 34px;
  padding: 6px 13px;
  font-size: 0.82rem;
  gap: 6px;
}

.btn-xs {
  min-height: 30px;
  padding: 4px 10px;
  font-size: 0.78rem;
  border-radius: 8px;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: 10px;
}

.btn-link {
  background: none;
  border: none;
  padding: 0;
  min-height: 0;
  color: var(--green-700);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-link:hover {
  color: var(--green-600);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.btn-link.danger {
  color: var(--red-700);
}

/* ---------- form controls ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: 0.015em;
}

.field-hint {
  font-size: 0.76rem;
  color: var(--ink-3);
}

.field-error {
  font-size: 0.78rem;
  color: var(--red-700);
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.92rem;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--ink-4);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--green-600);
  box-shadow: 0 0 0 3px rgba(27, 119, 87, 0.14);
}

.input[disabled],
.select[disabled],
.textarea[disabled] {
  background: #f3f2ec;
  color: var(--ink-3);
  cursor: not-allowed;
}

.textarea {
  resize: vertical;
  min-height: 90px;
  line-height: 1.5;
}

.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%),
    linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 18px) 18px, calc(100% - 13px) 18px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrap .input {
  padding-right: 44px;
}

.input-affix {
  position: absolute;
  right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--ink-3);
  border-radius: 7px;
  cursor: pointer;
}
.input-affix:hover {
  background: var(--cream);
  color: var(--ink);
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--ink-2);
  cursor: pointer;
}

.check input {
  width: 17px;
  height: 17px;
  margin: 2px 0 0;
  accent-color: var(--green-700);
  flex: none;
  cursor: pointer;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--ink-2);
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-track {
  width: 44px;
  height: 25px;
  border-radius: 999px;
  background: #cfd8d2;
  position: relative;
  flex: none;
  transition: background 0.16s ease;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.16s ease;
}

.switch input:checked + .switch-track {
  background: var(--green-600);
}
.switch input:checked + .switch-track::after {
  transform: translateX(19px);
}
.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--green-600);
  outline-offset: 2px;
}

.form-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.form-grid .span-2 {
  grid-column: 1 / -1;
}

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

.form-note {
  font-size: 0.8rem;
  color: var(--ink-3);
}

/* ---------- pills, avatars, progress ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.035em;
  text-transform: uppercase;
  background: var(--cream-2);
  color: var(--ink-2);
  white-space: nowrap;
}

.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}

.pill-success {
  background: var(--green-100);
  color: var(--green-700);
}
.pill-warning {
  background: var(--amber-100);
  color: var(--amber-700);
}
.pill-danger {
  background: var(--red-100);
  color: var(--red-700);
}
.pill-info {
  background: var(--blue-100);
  color: var(--blue-700);
}
.pill-neutral {
  background: var(--cream-2);
  color: var(--ink-2);
}
.pill-plain::before {
  display: none;
}

.role-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #e5efe9;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.avatar {
  --avatar-bg: var(--green-100);
  --avatar-fg: var(--green-700);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--avatar-bg);
  color: var(--avatar-fg);
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.02em;
  flex: none;
}

.avatar-lg {
  width: 60px;
  height: 60px;
  font-size: 1.3rem;
}
.avatar-sm {
  width: 34px;
  height: 34px;
  font-size: 0.8rem;
}

.avatar-tone-1 {
  --avatar-bg: #f6e7cf;
  --avatar-fg: #8a5a12;
}
.avatar-tone-2 {
  --avatar-bg: #e2e9f5;
  --avatar-fg: #2a5c86;
}
.avatar-tone-3 {
  --avatar-bg: #f2e2e4;
  --avatar-fg: #98434b;
}
.avatar-tone-4 {
  --avatar-bg: #e4efe4;
  --avatar-fg: #356b45;
}

.progress {
  height: 7px;
  border-radius: 999px;
  background: #e9e6dc;
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green-600);
  transition: width 0.4s ease;
}

.progress.warn > span {
  background: var(--amber-600);
}
.progress.danger > span {
  background: var(--red-700);
}

/* ---------- typography helpers ---------- */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green-600);
}

.eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: currentColor;
  opacity: 0.6;
}

.lede {
  font-size: clamp(1rem, 1.5vw, 1.1rem);
  color: var(--ink-2);
  line-height: 1.65;
  max-width: 60ch;
}

.muted {
  color: var(--ink-3);
}

.tiny {
  font-size: 0.76rem;
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.85em;
  letter-spacing: -0.01em;
}

.serif {
  font-family: var(--font-serif);
}

.amount {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.amount-negative {
  color: var(--red-700);
}

.amount-positive {
  color: var(--green-700);
}

.nowrap {
  white-space: nowrap;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.stack-sm {
  gap: 8px;
}
.stack-lg {
  gap: 24px;
}

.plain-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.plain-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
}
.plain-list li .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green-600, #2f7d4f);
  flex: none;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.row-wrap {
  flex-wrap: wrap;
}
.grow {
  flex: 1;
  min-width: 0;
}
.align-start {
  align-items: flex-start;
}

.grid-2 {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.grid-3 {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.grid-4 {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.grid-cards {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
}

.hide {
  display: none !important;
}

/* ==========================================================================
   Public site
   ========================================================================== */

.public-shell {
  min-height: 100vh;
  background:
    radial-gradient(1000px 520px at 85% -10%, rgba(27, 119, 87, 0.14), transparent 60%),
    radial-gradient(720px 420px at -10% 8%, rgba(192, 122, 24, 0.1), transparent 55%),
    var(--cream);
}

.public-nav {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}
.brand:hover {
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--green-800);
  color: #f3f8f4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: var(--shadow-sm);
  flex: none;
}

.brand-mark.has-logo {
  background: #fff;
  overflow: hidden;
  padding: 2px;
}

.brand-mark.has-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: inherit;
  display: block;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.brand-name {
  font-family: var(--font-serif);
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--ink);
}
.brand-sub {
  font-size: 0.68rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 26px;
  font-size: 0.88rem;
  font-weight: 500;
}
.nav-links a {
  color: var(--ink-2);
  text-decoration: none;
}
.nav-links a:hover {
  color: var(--green-700);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hero {
  max-width: 1180px;
  margin: 0 auto;
  padding: 44px 28px 64px;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 56px;
  align-items: center;
}

.hero h1 {
  margin: 18px 0 18px;
}

.hero h1 em {
  font-style: italic;
  color: var(--green-700);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.hero-meta {
  margin-top: 30px;
  display: flex;
  flex-wrap: wrap;
  gap: 18px 26px;
  font-size: 0.86rem;
  color: var(--ink-2);
}

.hero-meta .row {
  gap: 9px;
}

.hero-meta .icon {
  color: var(--green-600);
}

.hero-card {
  position: relative;
  background: var(--green-900);
  color: #eaf2ed;
  border-radius: 26px;
  padding: 30px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.hero-card::after {
  content: "";
  position: absolute;
  right: -70px;
  top: -70px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.14), transparent 65%);
  pointer-events: none;
}

.hero-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(234, 242, 237, 0.7);
}

.hero-card h3 {
  margin: 20px 0 4px;
  font-size: 1.35rem;
  color: #fff;
  font-weight: 500;
}

.hero-balance {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 3.4vw, 2.7rem);
  margin: 6px 0 2px;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.hero-grid {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  overflow: hidden;
}

.hero-grid > div {
  background: rgba(255, 255, 255, 0.045);
  padding: 14px 16px;
}

.hero-grid dt {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(234, 242, 237, 0.62);
}
.hero-grid dd {
  margin: 4px 0 0;
  font-size: 1.02rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.hero-formula {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 0.78rem;
  color: rgba(234, 242, 237, 0.68);
  display: flex;
  align-items: center;
  gap: 8px;
}

.hero-formula code {
  font-family: var(--font-mono);
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 7px;
  border-radius: 5px;
}

.public-section {
  max-width: 1180px;
  margin: 0 auto;
  padding: 54px 28px;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.section-head h2 {
  margin-top: 10px;
}

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

.feature {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-xs);
}

.feature-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--green-100);
  color: var(--green-700);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.feature h3 {
  font-size: 1rem;
  margin-bottom: 6px;
}

.feature p {
  font-size: 0.86rem;
  color: var(--ink-2);
  line-height: 1.55;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  counter-reset: step;
}

.step {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 22px 22px;
  box-shadow: var(--shadow-xs);
}

.step::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  font-family: var(--font-serif);
  font-size: 0.9rem;
  color: var(--amber-700);
  font-weight: 600;
  border: 1px solid var(--amber-100);
  background: #fdf6e8;
  border-radius: 8px;
  padding: 3px 8px;
  display: inline-block;
  margin-bottom: 14px;
}

.step h3 {
  font-size: 1.02rem;
  margin-bottom: 6px;
}

.step p {
  font-size: 0.87rem;
  color: var(--ink-2);
}

.channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.channel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.channel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.channel-head h3 {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.channel-number {
  font-family: var(--font-mono);
  font-size: 1.02rem;
  color: var(--ink);
}

.channel p {
  font-size: 0.8rem;
  color: var(--ink-3);
}

.notice {
  display: flex;
  gap: 14px;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: var(--amber-100);
  border: 1px solid #f0dcb6;
  color: #6e4a0d;
  font-size: 0.86rem;
  line-height: 1.55;
}

.notice .icon {
  color: var(--amber-700);
  margin-top: 2px;
}

.notice strong {
  display: block;
  font-size: 0.88rem;
  margin-bottom: 2px;
}

.public-footer {
  border-top: 1px solid var(--line);
  margin-top: 30px;
}
.footer-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 28px 42px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 26px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--ink-3);
}
.footer-inner p {
  max-width: 46ch;
  margin-top: 8px;
  line-height: 1.6;
}
.footer-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: right;
}

/* ==========================================================================
   Auth pages
   ========================================================================== */

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
}

.auth-brand {
  position: relative;
  background:
    radial-gradient(700px 400px at 90% 0%, rgba(35, 141, 104, 0.4), transparent 60%),
    radial-gradient(500px 400px at 0% 100%, rgba(192, 122, 24, 0.18), transparent 60%),
    var(--green-900);
  color: #eaf2ed;
  padding: 46px 52px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

.auth-brand .brand-name,
.auth-brand .brand-sub {
  color: #f2f7f4;
}
.auth-brand .brand-sub {
  color: rgba(234, 242, 237, 0.62);
}
.auth-brand .brand-mark {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.24);
  box-shadow: none;
}

.auth-quote {
  max-width: 420px;
  margin: 40px 0;
}
.auth-quote h2 {
  color: #fff;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  font-weight: 500;
  margin-bottom: 18px;
}
.auth-quote p {
  color: rgba(234, 242, 237, 0.72);
  font-size: 0.95rem;
  line-height: 1.65;
}

.auth-brand-footer {
  font-size: 0.8rem;
  color: rgba(234, 242, 237, 0.6);
  display: flex;
  flex-direction: column;
  gap: 5px;
  line-height: 1.6;
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 28px 60px;
  background: var(--cream);
}

.auth-card {
  width: min(460px, 100%);
}

.auth-card-wide {
  width: min(620px, 100%);
}

.auth-card h1 {
  font-size: clamp(1.7rem, 3vw, 2.15rem);
  margin: 10px 0 8px;
}

.auth-card > .muted {
  font-size: 0.9rem;
}

.auth-form {
  margin-top: 26px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-footnote {
  margin-top: 20px;
  font-size: 0.87rem;
  color: var(--ink-3);
  text-align: center;
}
.auth-footnote a {
  font-weight: 600;
}

.auth-top-link {
  margin-bottom: 26px;
  font-size: 0.84rem;
}
.auth-top-link a {
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.auth-alert {
  margin-top: 22px;
}

/* Status pages (verify/reset) */

.state-card {
  margin-top: 26px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--radius);
  padding: 26px;
  text-align: center;
  box-shadow: var(--shadow-xs);
}

.state-icon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}
.state-icon.success {
  background: var(--green-100);
  color: var(--green-700);
}
.state-icon.error {
  background: var(--red-100);
  color: var(--red-700);
}
.state-icon.info {
  background: var(--blue-100);
  color: var(--blue-700);
}
.state-card h2 {
  font-size: 1.25rem;
  margin-bottom: 8px;
}
.state-card p {
  font-size: 0.9rem;
  color: var(--ink-2);
  margin-bottom: 18px;
}

/* ==========================================================================
   Application shell
   ========================================================================== */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 22px 16px 18px;
  background:
    radial-gradient(340px 220px at 20% 0%, rgba(35, 141, 104, 0.28), transparent 70%),
    linear-gradient(180deg, var(--green-950), var(--green-900) 60%, #0d3427);
  color: #dfeae4;
  overflow-y: auto;
  z-index: 60;
}

.sidebar .brand {
  padding: 4px 8px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 12px;
}
.sidebar .brand-mark {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  box-shadow: none;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  font-size: 1rem;
}
.sidebar .brand-name {
  color: #f4f8f5;
  font-size: 0.96rem;
}
.sidebar .brand-sub {
  color: rgba(223, 234, 228, 0.55);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-label {
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(223, 234, 228, 0.45);
  font-weight: 700;
  padding: 0 12px 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 9px;
  color: rgba(230, 240, 234, 0.8);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.14s ease, color 0.14s ease;
  position: relative;
}

.nav-link .icon {
  opacity: 0.75;
  width: 18px;
  height: 18px;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  text-decoration: none;
}
.nav-link:hover .icon {
  opacity: 1;
}

.nav-link.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.nav-link.active::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #d9b061;
}
.nav-link.active .icon {
  opacity: 1;
  color: #e8c47c;
}

.nav-link .nav-count {
  margin-left: auto;
  font-size: 0.68rem;
  background: rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  padding: 1px 7px;
  font-weight: 700;
  color: #fff;
}

.nav-children {
  padding-left: 30px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.81rem;
  color: rgba(230, 240, 234, 0.66);
  padding: 6px 10px;
  border-radius: 7px;
  text-decoration: none;
}
.nav-child:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  text-decoration: none;
}
.nav-child.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}
.nav-child .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #d9b061;
  opacity: 0.7;
  flex: none;
}

.sidebar-foot {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 14px;
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px;
  min-width: 0;
}
.sidebar-user .avatar {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  width: 36px;
  height: 36px;
  font-size: 0.82rem;
  font-family: var(--font-sans);
  font-weight: 600;
}
.sidebar-user-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.sidebar-user-info strong {
  font-size: 0.82rem;
  font-weight: 600;
  color: #f0f6f2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-info span {
  font-size: 0.68rem;
  color: rgba(223, 234, 228, 0.55);
  text-transform: capitalize;
}

.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: transparent;
  color: rgba(234, 242, 237, 0.78);
  border-radius: 9px;
  padding: 8px 11px;
  font-size: 0.8rem;
  cursor: pointer;
  width: 100%;
}
.sidebar-logout:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.sidebar-install {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(234, 242, 237, 0.9);
  border-radius: 9px;
  padding: 8px 11px;
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  width: 100%;
}
.sidebar-install:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.sidebar-version {
  padding: 0 6px;
  font-size: 0.66rem;
  letter-spacing: 0.03em;
  color: rgba(223, 234, 228, 0.42);
}

.sidebar-close {
  display: none;
}

.content {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: var(--topbar-height);
  padding: 12px 30px;
  background: rgba(246, 244, 238, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-title {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.term-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.76rem;
  color: var(--ink-2);
  font-weight: 600;
  white-space: nowrap;
}
.term-chip .icon {
  width: 14px;
  height: 14px;
  color: var(--green-600);
}

.menu-btn {
  display: none;
}

.view {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 28px 30px 64px;
}

.nav-backdrop {
  display: none;
}

/* ---------- page header ---------- */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.page-head .eyebrow {
  margin-bottom: 8px;
}

.page-head h1 {
  font-size: clamp(1.65rem, 2.6vw, 2.15rem);
}

.page-head p {
  margin-top: 7px;
  color: var(--ink-3);
  font-size: 0.9rem;
  max-width: 68ch;
}

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

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 14px;
}
.back-link:hover {
  color: var(--green-700);
  text-decoration: none;
}

/* ---------- cards ---------- */

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
}

.card-pad {
  padding: 22px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.card-head h2,
.card-head h3 {
  font-size: 1.02rem;
  font-family: var(--font-sans);
  font-weight: 700;
  letter-spacing: -0.005em;
}

.card-head p {
  font-size: 0.8rem;
  color: var(--ink-3);
  margin-top: 3px;
}

.card-body {
  padding: 22px;
}

.card-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  background: #fbfaf6;
  border-radius: 0 0 var(--radius) var(--radius);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--ink-3);
}

.card-accent-top {
  border-top: 3px solid var(--green-700);
}

/* ---------- stat cards ---------- */

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

.stat {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.stat-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.stat-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--green-50);
  color: var(--green-700);
}
.stat-icon .icon {
  width: 16px;
  height: 16px;
}

.stat-value {
  font-family: var(--font-serif);
  font-size: clamp(1.35rem, 2.1vw, 1.72rem);
  font-weight: 600;
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-hint {
  font-size: 0.76rem;
  color: var(--ink-3);
}

.stat.is-alert .stat-icon {
  background: var(--amber-100);
  color: var(--amber-700);
}
.stat.is-danger .stat-icon {
  background: var(--red-100);
  color: var(--red-700);
}
.stat.is-neutral .stat-icon {
  background: var(--blue-100);
  color: var(--blue-700);
}

/* ---------- balance hero ---------- */

.balance-hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(500px 260px at 100% 0%, rgba(35, 141, 104, 0.35), transparent 65%),
    linear-gradient(135deg, var(--green-900), #114a37);
  color: #e9f3ee;
  border-radius: var(--radius-lg);
  padding: 26px 28px;
  box-shadow: var(--shadow-md);
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 24px;
  margin-bottom: 24px;
}

.balance-hero h2 {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: rgba(233, 243, 238, 0.55);
  font-weight: 700;
}

.balance-figure {
  font-family: var(--font-serif);
  font-size: clamp(2.1rem, 4vw, 3rem);
  color: #fff;
  line-height: 1.1;
  margin: 8px 0 4px;
  font-variant-numeric: tabular-nums;
}

.balance-figure.credit {
  color: #f2d492;
}

.balance-sub {
  font-size: 0.84rem;
  color: rgba(233, 243, 238, 0.68);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.balance-hero .pill {
  background: rgba(255, 255, 255, 0.14);
  color: #f5faf7;
}

.balance-hero .pill::before {
  opacity: 0.9;
}

.balance-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  overflow: hidden;
  align-self: start;
}

.balance-stats > div {
  background: rgba(255, 255, 255, 0.05);
  padding: 12px 14px;
}

.balance-stats dt {
  font-size: 0.66rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: rgba(233, 243, 238, 0.55);
}
.balance-stats dd {
  margin: 3px 0 0;
  font-size: 0.95rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.balance-hero-actions {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.balance-hero .btn-light {
  --btn-fg: #f0f7f3;
}

.balance-hero .btn-white {
  --btn-fg: var(--green-900);
}

/* ---------- children cards ---------- */

.child-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: box-shadow 0.16s ease, transform 0.16s ease, border-color 0.16s ease;
}

.child-card:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--line-strong);
}

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

.child-head h3 {
  font-family: var(--font-sans);
  font-size: 0.98rem;
  font-weight: 700;
}
.child-head .muted {
  font-size: 0.78rem;
}

.child-balance {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding-top: 4px;
}

.child-balance .label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-3);
  font-weight: 700;
}
.child-balance .value {
  font-family: var(--font-serif);
  font-size: 1.55rem;
  font-weight: 600;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

.child-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
  font-size: 0.79rem;
  color: var(--ink-3);
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.child-meta strong {
  display: block;
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.child-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}
.child-actions .btn {
  flex: 1;
}

.due-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  color: var(--ink-3);
}
.due-line.overdue {
  color: var(--red-700);
  font-weight: 600;
}
.due-line .icon {
  width: 13px;
  height: 13px;
}

/* ---------- term cards ---------- */

.term-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

.term-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
  background: #fdfcf9;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.term-card.is-current {
  border-color: var(--green-600);
  background: var(--green-50);
}

.term-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.term-card-top strong {
  font-size: 0.86rem;
}
.term-card-top .tiny {
  color: var(--ink-3);
}

.term-amount {
  font-family: var(--font-serif);
  font-size: 1.28rem;
  font-variant-numeric: tabular-nums;
}
.term-amount.is-zero {
  color: var(--green-700);
}

.term-split {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--ink-3);
}

.term-split strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* ---------- tables ---------- */

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.table th {
  text-align: left;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 700;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfaf6;
  white-space: nowrap;
  position: sticky;
  top: 0;
}

.table td {
  padding: 12px 14px;
  border-bottom: 1px solid #efede5;
  vertical-align: middle;
  color: var(--ink-2);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table tbody tr:hover td {
  background: #fbfaf5;
}

.table tr.is-clickable {
  cursor: pointer;
}

.table .primary-cell {
  color: var(--ink);
  font-weight: 600;
}

.table .sub {
  display: block;
  font-size: 0.74rem;
  color: var(--ink-3);
  font-weight: 400;
  margin-top: 1px;
}

.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.table .actions {
  text-align: right;
  white-space: nowrap;
}

.table .actions .btn {
  margin-left: 4px;
}

.table-compact td {
  padding: 9px 12px;
}
.table-compact th {
  padding: 8px 12px;
}

.table-total td {
  background: #fbfaf6;
  font-weight: 700;
  color: var(--ink);
  border-top: 1px solid var(--line-strong);
}

.cell-strong {
  color: var(--ink);
  font-weight: 600;
}

.cell-amount {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--ink);
}

.cell-amount.credit {
  color: var(--green-700);
}
.cell-amount.debit {
  color: var(--ink);
}

.empty {
  padding: 44px 24px;
  text-align: center;
  color: var(--ink-3);
}
.empty .icon {
  width: 30px;
  height: 30px;
  margin: 0 auto 10px;
  color: var(--ink-4);
}
.empty h3 {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink-2);
  margin-bottom: 4px;
}
.empty p {
  font-size: 0.84rem;
  max-width: 46ch;
  margin: 0 auto;
}
.empty .btn {
  margin-top: 16px;
}

/* ---------- filters ---------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: #fbfaf6;
  border-radius: var(--radius) var(--radius) 0 0;
}

.filters .field {
  min-width: 150px;
  flex: 1;
}

.filters .field.grow {
  flex: 2 1 220px;
}

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

.filters .input,
.filters .select {
  min-height: 38px;
  font-size: 0.85rem;
  background-color: #fff;
}

/* ---------- tabs ---------- */

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  margin-bottom: 22px;
}

.tab {
  appearance: none;
  border: none;
  background: transparent;
  padding: 11px 15px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink-3);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.tab:hover {
  color: var(--ink);
}
.tab.active {
  color: var(--green-800);
  border-bottom-color: var(--green-700);
}
.tab .count {
  font-size: 0.7rem;
  background: var(--cream-2);
  border-radius: 999px;
  padding: 1px 6px;
  color: var(--ink-2);
}
.tab.active .count {
  background: var(--green-100);
  color: var(--green-700);
}

/* ---------- split layouts ---------- */

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

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

.side-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: calc(var(--topbar-height) + 18px);
}

.detail-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  font-size: 0.85rem;
}
.detail-list > div {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.detail-list dt,
.detail-list .k {
  color: var(--ink-3);
  flex: none;
}
.detail-list dd,
.detail-list .v {
  margin: 0;
  text-align: right;
  color: var(--ink);
  font-weight: 500;
  overflow-wrap: anywhere;
}

.info-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  line-height: 1.55;
  background: var(--green-50);
  border: 1px solid #d7e7de;
  color: var(--green-800);
}
.info-banner .icon {
  color: var(--green-600);
  margin-top: 2px;
}
.info-banner.warn {
  background: var(--amber-100);
  border-color: #f0dcb6;
  color: #6e4a0d;
}
.info-banner.warn .icon {
  color: var(--amber-700);
}
.info-banner.danger {
  background: var(--red-100);
  border-color: #f2d3d0;
  color: #7f2f29;
}
.info-banner.danger .icon {
  color: var(--red-700);
}
.info-banner strong {
  font-weight: 700;
}

/* ---------- channels ---------- */

.pay-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}

.pay-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-xs);
}

.pay-card-head {
  display: flex;
  align-items: center;
  gap: 11px;
}
.pay-card-head .feature-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  margin: 0;
  background: var(--green-50);
}
.pay-card-head h3 {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 700;
}

.pay-number {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #fbfaf6;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 8px 10px;
}

.pay-number code {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.pay-number span {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-3);
  display: block;
  margin-bottom: 1px;
}

.pay-card p {
  font-size: 0.8rem;
  color: var(--ink-3);
  line-height: 1.55;
}

.copy-btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 7px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-2);
  cursor: pointer;
  flex: none;
}
.copy-btn:hover {
  border-color: var(--green-600);
  color: var(--green-700);
}

/* ---------- statement options ---------- */

.statement-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.statement-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 18px;
  background: #fdfcf9;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.statement-card h3 {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 700;
}
.statement-card p {
  font-size: 0.79rem;
  color: var(--ink-3);
  flex: 1;
}

/* ---------- audit / ledger entries ---------- */

.entry-type {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.entry-type.charge {
  color: var(--ink);
}
.entry-type.payment {
  color: var(--green-700);
}
.entry-type.reversal {
  color: var(--red-700);
}
.entry-type.credit {
  color: var(--blue-700);
}
.entry-type.adjustment {
  color: var(--amber-700);
}
.entry-type.opening {
  color: var(--ink-3);
}

.line-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- modal ---------- */

.modal {
  border: none;
  border-radius: var(--radius-lg);
  padding: 0;
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
}

.modal::backdrop {
  background: rgba(8, 30, 22, 0.55);
  backdrop-filter: blur(2px);
}

.modal-lg {
  width: min(780px, calc(100vw - 32px));
}
.modal-sm {
  width: min(420px, calc(100vw - 32px));
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
}
.modal-head h2 {
  font-size: 1.2rem;
}
.modal-head p {
  font-size: 0.82rem;
  color: var(--ink-3);
  margin-top: 4px;
}
.modal-close {
  border: none;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.modal-close:hover {
  background: var(--cream);
  color: var(--ink);
}

.modal-body {
  padding: 22px 24px;
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--line);
  background: #fbfaf6;
  flex-wrap: wrap;
}

.modal-form {
  display: flex;
  flex-direction: column;
}

/* ---------- toasts ---------- */

.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--green-600);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  padding: 12px 14px;
  font-size: 0.85rem;
  color: var(--ink-2);
  animation: toast-in 0.2s ease;
}

.toast .icon {
  color: var(--green-600);
  margin-top: 1px;
}
.toast.error {
  border-left-color: var(--red-700);
}
.toast.error .icon {
  color: var(--red-700);
}
.toast.warn {
  border-left-color: var(--amber-600);
}
.toast.warn .icon {
  color: var(--amber-700);
}
.toast strong {
  display: block;
  color: var(--ink);
  font-size: 0.86rem;
  margin-bottom: 1px;
}
.toast p {
  font-size: 0.8rem;
  line-height: 1.45;
}

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

/* ---------- student picker ---------- */

.student-picker {
  position: relative;
}

.picker-results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 5px);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  z-index: 50;
  max-height: 260px;
  overflow-y: auto;
}

.picker-results:empty {
  display: none;
}

.picker-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 9px 12px;
  cursor: pointer;
  text-align: left;
  font-size: 0.82rem;
  color: var(--ink-2);
}
.picker-option:last-child {
  border-bottom: none;
}
.picker-option:hover {
  background: var(--green-50);
}
.picker-option strong {
  color: var(--ink);
  font-weight: 600;
}
.picker-option .mono {
  color: var(--ink-3);
}

.picked-student {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--green-100);
  background: var(--green-50);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font-size: 0.85rem;
}
.picked-student .grow {
  display: flex;
  flex-direction: column;
  gap: 0;
  line-height: 1.35;
}
.picked-student strong {
  font-size: 0.86rem;
}
.picked-student .tiny {
  color: var(--ink-3);
}

/* ---------- misc ---------- */

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 60px 20px;
  color: var(--ink-3);
  font-size: 0.85rem;
}

.spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2.5px solid var(--line-strong);
  border-top-color: var(--green-600);
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.skeleton {
  border-radius: 8px;
  background: linear-gradient(90deg, #ece9df 25%, #f4f2ea 37%, #ece9df 63%);
  background-size: 400% 100%;
  animation: shimmer 1.2s ease infinite;
  min-height: 14px;
}

@keyframes shimmer {
  0% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0 50%;
  }
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 18px 0;
}

.kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
}

.kv .k {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-3);
  font-weight: 700;
}
.kv .v {
  margin-top: 3px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--ink-3);
  flex-wrap: wrap;
}
.pagination-actions {
  display: flex;
  gap: 8px;
}

.report-grid {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.report-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  position: sticky;
  top: calc(var(--topbar-height) + 18px);
}

.report-nav button {
  appearance: none;
  border: none;
  background: transparent;
  text-align: left;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--ink-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 9px;
}
.report-nav button:hover {
  background: rgba(15, 61, 46, 0.06);
}
.report-nav button.active {
  background: #fff;
  color: var(--green-800);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--line);
}

.report-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.chart-bars {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chart-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) 90px;
  gap: 12px;
  align-items: center;
  font-size: 0.8rem;
}
.chart-row .bar {
  height: 9px;
  border-radius: 999px;
  background: var(--cream-2);
  overflow: hidden;
}
.chart-row .bar span {
  display: block;
  height: 100%;
  background: var(--green-600);
  border-radius: inherit;
}
.chart-row .val {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  font-weight: 600;
}

.result-box {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fbfaf6;
  padding: 14px;
  font-size: 0.82rem;
  max-height: 280px;
  overflow: auto;
}
.result-box ul {
  margin: 8px 0 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.status-line {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.8rem;
  color: var(--ink-3);
}

.prose {
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--ink-2);
}
.prose p + p {
  margin-top: 10px;
}

.callout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.mini-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
  background: #fdfcf9;
}
.mini-card h4 {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 5px;
}
.mini-card p {
  font-size: 0.79rem;
  color: var(--ink-3);
}

.channel-editor {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1180px) {
  .feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .split {
    grid-template-columns: 1fr;
  }
  .side-stack {
    position: static;
  }
  .report-grid {
    grid-template-columns: 190px minmax(0, 1fr);
  }
}

@media (max-width: 1020px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 40px;
    padding-top: 28px;
  }
  .hero-card {
    max-width: 560px;
  }
  .auth-shell {
    grid-template-columns: 1fr;
  }
  .auth-brand {
    padding: 30px 28px;
    min-height: auto;
    gap: 20px;
  }
  .auth-quote {
    margin: 10px 0 0;
  }
  .auth-quote h2 {
    font-size: 1.6rem;
  }
  .auth-quote p {
    font-size: 0.86rem;
  }
  .auth-brand-footer {
    display: none;
  }
  .auth-panel {
    padding: 34px 22px 60px;
  }
}

@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 280px;
    transform: translateX(-102%);
    transition: transform 0.22s ease;
    box-shadow: 30px 0 60px -30px rgba(0, 0, 0, 0.5);
  }
  .app-shell.nav-open .sidebar {
    transform: translateX(0);
  }
  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(8, 30, 22, 0.5);
    z-index: 55;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
  }
  .app-shell.nav-open .nav-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
  .sidebar-close {
    display: inline-flex;
    position: absolute;
    top: 18px;
    right: 12px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }
  .sidebar-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
  }
  .menu-btn {
    display: inline-flex;
  }
  .topbar {
    padding: 10px 18px;
  }
  .view {
    padding: 22px 18px 56px;
  }
  .balance-hero {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .report-grid {
    grid-template-columns: 1fr;
  }
  .report-nav {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 6px;
  }
  .report-nav button {
    white-space: nowrap;
  }
}

@media (max-width: 720px) {
  .public-nav {
    padding: 16px 18px;
  }
  .nav-links {
    display: none;
  }
  .hero {
    padding: 22px 18px 44px;
  }
  .public-section {
    padding: 40px 18px;
  }
  .feature-grid,
  .steps,
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .stat {
    padding: 14px 16px;
  }
  .term-chip {
    display: none;
  }
  .topbar-title {
    font-size: 0.95rem;
  }
  .filters {
    padding: 14px;
  }
  .filters .field {
    min-width: 100%;
  }
  .filters .filters-actions {
    width: 100%;
  }
  .filters .filters-actions .btn {
    flex: 1;
  }
  .page-head {
    margin-bottom: 18px;
  }
  .page-actions {
    width: 100%;
  }
  .page-actions .btn {
    flex: 1;
  }
  .card-head {
    padding: 15px 16px;
  }
  .card-body {
    padding: 16px;
  }
  .card-pad {
    padding: 16px;
  }
  .balance-hero {
    padding: 22px;
  }
  .balance-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .table th,
  .table td {
    padding: 10px 12px;
  }
  .footer-inner {
    flex-direction: column;
  }
  .footer-meta {
    text-align: left;
  }
  .modal-body {
    padding: 18px;
  }
  .modal-head {
    padding: 16px 18px 12px;
  }
  .modal-foot {
    padding: 14px 18px 16px;
  }
  .modal-foot .btn {
    flex: 1;
  }
  .chart-row {
    grid-template-columns: 100px minmax(0, 1fr) 80px;
  }
}

@media (max-width: 520px) {
  .brand-sub {
    display: none;
  }
  .stat-grid {
    grid-template-columns: 1fr;
  }
  .stat-value {
    font-size: 1.5rem;
  }
  .hero-grid {
    grid-template-columns: 1fr;
  }
  .auth-panel {
    padding: 26px 18px 50px;
  }
  .auth-card h1 {
    font-size: 1.6rem;
  }
  .view {
    padding: 18px 14px 50px;
  }
  .topbar {
    padding: 9px 14px;
  }
  .toast-stack {
    left: 14px;
    right: 14px;
    bottom: 14px;
    max-width: none;
  }
  .child-actions {
    flex-direction: column;
  }
  .statement-options {
    grid-template-columns: 1fr;
  }
}

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

/* ---------- admin console extras ---------- */

.table-card {
  overflow: hidden;
}

.code-block {
  margin: 0;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--green-950);
  color: #dbe9e2;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  line-height: 1.55;
  overflow: auto;
  max-height: 360px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}


/* ---------- installable app (PWA) ---------- */

.pwa-banner {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 2100;
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(560px, calc(100vw - 28px));
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: #fff;
  box-shadow: var(--shadow-md);
  font-size: 0.82rem;
  color: var(--ink-2);
}

.pwa-banner .icon {
  flex: 0 0 auto;
  color: var(--green-700);
}
.pwa-banner p {
  margin: 0;
  flex: 1 1 auto;
  line-height: 1.45;
}
.pwa-banner strong {
  color: var(--ink);
}
.pwa-banner .btn {
  flex: 0 0 auto;
}
.pwa-banner-offline {
  border-left: 4px solid var(--amber-600);
}
.pwa-banner-offline .icon {
  color: var(--amber-700);
}

.install-dialog {
  width: min(430px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-md);
  overflow: auto;
}
.install-dialog::backdrop {
  background: rgba(9, 26, 20, 0.48);
}
.install-dialog-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px 24px 20px;
}
.install-dialog-body h2 {
  margin: 0;
  font-size: 1.15rem;
}
.install-dialog-body p {
  margin: 0;
  color: var(--ink-2);
  font-size: 0.9rem;
  line-height: 1.55;
}
.install-steps {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 2px 0;
  padding-left: 20px;
  color: var(--ink-2);
  font-size: 0.9rem;
  line-height: 1.5;
}
.install-steps li::marker {
  color: var(--green-700);
  font-weight: 700;
}
.install-dialog-body .install-note {
  font-size: 0.79rem;
  color: var(--ink-3);
}
.install-dialog-body .btn {
  align-self: flex-end;
}

.offline-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--cream);
}

.offline-card {
  width: min(440px, 100%);
  padding: 32px 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow-md);
  text-align: center;
}

.offline-card img {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  display: block;
  border-radius: 14px;
}

.offline-card h1 {
  font-size: 1.35rem;
  margin-bottom: 8px;
}

.offline-card p {
  color: var(--ink-2);
  font-size: 0.9rem;
  line-height: 1.55;
}

.logo-upload {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.logo-preview {
  display: flex;
  align-items: center;
  min-height: 72px;
}

.logo-preview img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  padding: 4px;
  border: 1px solid var(--line, #d1d5db);
  border-radius: var(--radius-sm, 10px);
  background: #fff;
}

.offline-card .offline-note {
  margin: 14px 0 20px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--amber-100);
  color: var(--amber-700);
  font-size: 0.8rem;
  line-height: 1.5;
}
