.template-home, .template-auth, .template-camaba {
  --portal-ink: #0f172a;
  --portal-muted: #475569;
  --portal-green: #047857;
  --portal-deep: #022c22;
  --portal-tint: #ecfdf5;
  --portal-amber: #fbbf24;
  --portal-line: #e2e8f0;
  --portal-surface: #fff;
  --portal-page: #f8fafc;
  --portal-soft: #f1f5f9;
  --portal-shadow: 0 12px 32px #0f172a0b;
  --portal-display: "Plus Jakarta Sans", Outfit, system-ui, sans-serif;
  --ink: var(--portal-ink);
  --ink-soft: var(--portal-muted);
  --line: var(--portal-line);
  --green-700: var(--portal-green);
  --green-900: var(--portal-green);
  background: var(--portal-page);
  color: var(--portal-ink);
  font-family: Inter, "Work Sans", system-ui, sans-serif;
}
[data-pmb-theme="dark"] :is(.template-home, .template-auth, .template-camaba) {
  --portal-ink: #f1f5f9;
  --portal-muted: #b5c2d1;
  --portal-green: #6ee7b7;
  --portal-tint: #07382c;
  --portal-line: #334155;
  --portal-surface: #0f172a;
  --portal-page: #020617;
  --portal-soft: #1e293b;
  --portal-shadow: 0 12px 32px #0004;
  --danger: #fca5a5;
  color-scheme: dark;
}
:is(.template-home, .template-auth, .template-camaba) :is(h1, h2, h3, h4, .button) { font-family: var(--portal-display); }
:is(.template-home, .template-auth) .container { width: min(calc(100% - 2rem), 75rem); }
:is(.template-home, .template-auth, .template-camaba) .button { border-radius: 12px; font-weight: 700; }
:is(.template-home, .template-auth, .template-camaba) .button:hover { text-decoration: none; }
:is(.template-home, .template-auth, .template-camaba) .button-primary { background: #047857; color: #fff; }
:is(.template-home, .template-auth, .template-camaba) .button-primary:hover { background: #065f46; }
:is(.template-home, .template-auth, .template-camaba) .button-primary svg { color: #fde68a; }
:is(.template-home, .template-auth, .template-camaba) .button-outline { background: var(--portal-surface); color: var(--portal-ink); border-color: var(--portal-line); }
:is(.template-home, .template-auth, .template-camaba) .button-outline:hover { background: var(--portal-soft); color: var(--portal-green); border-color: var(--portal-green); }
:is(.template-home, .template-auth) .button-gold { background: var(--portal-amber); color: #172033; }
:is(.template-home, .template-auth) .button-gold:hover { background: #fcd34d; }
:is(.template-home, .template-auth, .template-camaba) svg { flex-shrink: 0; }
:is(.template-home, .template-auth, .template-camaba) .text-link svg { width: 16px; height: 16px; }

.portal-brand { display: inline-flex; align-items: center; gap: 11px; min-width: 0; color: var(--portal-ink); }
.portal-brand:hover { color: var(--portal-ink); text-decoration: none; }
.portal-brand-mark { display: grid; place-items: center; width: 44px; height: 44px; flex: 0 0 auto; border: 1px solid #d1fae5; border-radius: 12px; background: #fff; box-shadow: 0 5px 12px #022c221a; }
.portal-brand-mark img { width: 33px; height: 33px; object-fit: contain; }
.portal-brand strong { display: block; font: 800 1rem/1.1 var(--portal-display); }
.portal-brand small { display: block; max-width: 245px; margin-top: 3px; color: var(--portal-green); font-size: .68rem; line-height: 1.2; }
.portal-actions { display: flex; align-items: center; gap: 8px; }
.theme-toggle { display: inline-grid; place-items: center; width: 44px; height: 44px; flex: 0 0 auto; padding: 0; border: 1px solid var(--portal-line); border-radius: 12px; background: var(--portal-soft); color: var(--portal-ink); }
.theme-toggle:hover { color: var(--portal-green); border-color: var(--portal-green); }
.theme-toggle span, .theme-toggle svg { display: block; }
.theme-toggle .theme-sun, [data-pmb-theme="dark"] .theme-toggle .theme-moon { display: none; }
[data-pmb-theme="dark"] .theme-toggle .theme-sun { display: block; color: var(--portal-amber); }
.portal-kicker { margin: 0; color: var(--portal-green); font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.portal-tag { display: inline-flex; align-items: center; gap: 8px; width: fit-content; padding: 5px 11px; border: 1px solid color-mix(in srgb, var(--portal-green) 20%, var(--portal-tint)); border-radius: 999px; background: var(--portal-tint); color: var(--portal-green); font-size: .75rem; font-weight: 700; line-height: 1.45; }
.portal-tag-neutral { border-color: var(--portal-line); background: var(--portal-soft); color: var(--portal-muted); }
.portal-tag svg { width: 16px; height: 16px; }
.portal-icon { display: inline-grid; place-items: center; width: 46px; height: 46px; flex: 0 0 auto; border-radius: 14px; background: var(--portal-tint); color: var(--portal-green); }
.portal-icon-amber { background: #fef3c7; color: #92400e; }

@media (max-width: 620px) {
  .portal-brand-mark { width: 37px; height: 37px; }
  .portal-brand-mark img { width: 28px; height: 28px; }
  .portal-brand strong { font-size: .85rem; }
  .portal-brand small { display: none; }
}
.template-auth { display: flex; flex-direction: column; min-height: 100dvh; }
.portal-auth-header { background: var(--portal-surface); }
.portal-auth-header .header-inner { justify-content: space-between; gap: 11px; min-height: 72px; }
.portal-auth-header .portal-brand strong { white-space: nowrap; }
.portal-auth-footer { margin-top: auto; border-top: 1px solid var(--portal-line); background: var(--portal-surface); color: var(--portal-muted); font-size: .78rem; }
.portal-auth-footer .container { display: flex; justify-content: space-between; align-items: center; gap: 14px; min-height: 68px; }
.portal-auth-footer a { display: inline-flex; align-items: center; gap: 6px; color: var(--portal-green); }
.portal-auth-footer svg { width: 15px; height: 15px; }

.template-auth .login-layout {
  width: min(calc(100% - 2rem), 59rem);
  min-height: 0;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  align-items: stretch;
  gap: 0;
  padding: 0;
  margin-block: clamp(32px, 7vw, 80px);
  border: 1px solid var(--portal-line);
  border-radius: 24px;
  overflow: hidden;
  background: var(--portal-surface);
  box-shadow: var(--portal-shadow);
}
.template-auth .login-panel { padding: clamp(20px, 4.5vw, 46px); border: 0; border-radius: 0; background: var(--portal-surface); box-shadow: none; }
.template-auth .login-panel h1 { margin-top: 0; color: var(--portal-ink); font-size: clamp(1.65rem, 3vw, 2.2rem); }
.portal-login-intro {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: end;
  padding: clamp(24px, 4vw, 40px);
  background: #022c22;
  color: #fff;
}
.portal-login-photo, .portal-login-intro::before { position: absolute; inset: 0; width: 100%; height: 100%; }
.portal-login-photo { object-fit: cover; object-position: 55% center; z-index: -2; }
.portal-login-intro::before { content: ""; z-index: -1; background: linear-gradient(160deg, #065f4694, #022c22 82%); }
.portal-login-copy .portal-icon { margin-bottom: 16px; }
.portal-login-copy h2 { color: #fff; font-size: clamp(1.6rem, 3vw, 2.2rem); }
.portal-login-copy p { margin: 10px 0 0; color: #d1fae5; font-size: .92rem; }

.template-auth .registration { padding-block: 25px 64px; }
.portal-breadcrumb { display: flex; align-items: center; gap: 8px; min-height: 44px; margin-bottom: 10px; color: var(--portal-muted); font-size: .83rem; }
.portal-breadcrumb a { color: var(--portal-green); }
.template-auth .registration-grid { grid-template-columns: minmax(0, .42fr) minmax(0, 1fr); gap: 0; align-items: stretch; border: 1px solid var(--portal-line); border-radius: 24px; background: var(--portal-surface); box-shadow: var(--portal-shadow); }
.template-auth .registration-sidebar { display: flex; flex-direction: column; gap: 15px; position: static; padding: clamp(18px, 2.85vw, 32px); border-radius: 23px 0 0 23px; background: linear-gradient(145deg, #065f46, #022c22 580px); color: #fff; }
.portal-registration-intro .portal-icon { margin-bottom: 17px; }
.portal-registration-intro .portal-kicker { color: #a7f3d0; }
.portal-registration-intro h1 { max-width: 16ch; margin: 6px 0 0; color: #fff; font-size: clamp(1.35rem, 2.35vw, 2rem); line-height: 1.15; }
.portal-registration-wave { display: flex; align-items: center; gap: 9px; margin-top: 17px; padding: 11px; border: 1px solid #ffffff36; border-radius: 11px; background: #ffffff0e; }
.portal-registration-wave svg { width: 18px; height: 18px; color: #fde68a; }
.portal-registration-wave strong, .portal-registration-wave small { display: block; }
.portal-registration-wave strong { font-size: .85rem; }
.portal-registration-wave small { color: #d1fae5; font-size: .73rem; }
.template-auth .registration-help { margin-top: 0; padding: 14px; border-color: #ffffff36; background: #ffffff0e; }
.template-auth .registration-help strong, .template-auth .registration-help .text-link { color: #fde68a; }
.template-auth .registration-help ul { color: #d1fae5; }
.template-auth .progress li { color: #e2e8f0; }
.template-auth .progress li[aria-current="step"] { background: #ffffff26; color: #fff; }
.template-auth .progress li span { flex: 0 0 auto; background: #ffffff20; color: #fff; }
.template-auth .progress li[aria-current="step"] span, .template-auth .progress li.is-complete span { background: #fbbf24; color: #172033; }
.template-auth .form-panel { width: auto; min-width: 0; padding: clamp(18px, 3vw, 38px); border: 0; border-radius: 0 23px 23px 0; background: var(--portal-surface); box-shadow: none; }
.template-auth .closed-panel { border: 1px solid var(--portal-line); border-radius: 19px; }
.template-auth .form-step h2 { color: var(--portal-ink); font-size: clamp(1.35rem, 2.5vw, 1.65rem); }
:is(.template-auth, .template-camaba) .field :is(label, .field-label) { color: var(--portal-ink); }
:is(.template-auth, .template-camaba) .field :is(input:not([type="checkbox"]), select, textarea) { border-color: var(--portal-line); background: var(--portal-page); color: var(--portal-ink); font-family: inherit; }
:is(.template-auth, .template-camaba) .field [aria-invalid="true"] { border-color: var(--danger); }
.template-auth .password-input input { padding-right: 6rem; }
.template-auth .password-toggle, .template-auth input::file-selector-button { background: var(--portal-tint); color: var(--portal-green); }
.template-auth :is(.registration-referral, .upload-guide, .upload-field, .scan-example) { border-color: var(--portal-line); background: var(--portal-soft); }
.template-auth .upload-field { background: var(--portal-surface); }
[data-pmb-theme="dark"] :is(.template-auth, .template-camaba) .form-error { border-color: #7f3030; background: #401b22; }
[data-pmb-theme="dark"] :is(.template-auth, .template-camaba) .form-success { border-color: #125b45; background: #092e25; }
[data-pmb-theme="dark"] :is(.template-auth, .template-camaba) .workflow-reason { background: #401b22; }

/* The existing camaba navigation and forms use the same portal palette. */
.template-camaba {
  --admin-ink: var(--portal-ink);
  --admin-muted: var(--portal-muted);
  --admin-border: var(--portal-line);
  --admin-surface: var(--portal-surface);
  --admin-canvas: var(--portal-page);
  --admin-shadow: var(--portal-shadow);
  --admin-danger: var(--danger);
  --admin-success: var(--portal-green);
}
.template-camaba .admin-topbar { background: var(--portal-surface); }
.template-camaba .admin-avatar { background: var(--portal-tint); }
.template-camaba .workflow-summary { background: var(--portal-surface); }
.template-camaba .admin-card { border-radius: 16px; }
.template-camaba .camaba-welcome {
  padding: clamp(18px, 4vw, 30px);
  border-radius: 18px;
  background: radial-gradient(circle at 92% 0, #21b88b33, transparent 42%), linear-gradient(125deg, #065f46, #022c22);
}
.template-camaba .camaba-welcome h1 { margin-block: 6px; color: #fff; }
.template-camaba .camaba-welcome p { color: #d1fae5; }
.camaba-progress { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.camaba-progress li { display: flex; flex-direction: column; gap: 9px; padding: 10px; border: 1px solid var(--portal-line); border-radius: 12px; background: var(--portal-page); }
.camaba-progress strong, .camaba-progress small { display: block; }
.camaba-progress strong { font-size: .82rem; }
.camaba-progress small { color: var(--portal-muted); font-size: .76rem; }
[data-pmb-theme="dark"] .template-camaba .admin-pill { background: #223149; color: #f1f5f9; border-color: #475569; }
[data-pmb-theme="dark"] .template-camaba .admin-pill-success { background: #07382c; color: #a7f3d0; border-color: #256c52; }
[data-pmb-theme="dark"] .template-camaba .admin-pill-danger { background: #401b22; color: #fecaca; border-color: #7f3030; }

@media (max-width: 760px) {
  .portal-auth-header .header-inner { min-height: 64px; }
  .portal-auth-header .portal-actions > a { font-size: .78rem; }
  .template-auth .login-layout { grid-template-columns: minmax(0, 1fr); max-width: 31rem; }
  .portal-login-intro { display: none; }
  .template-auth .registration-grid { grid-template-columns: minmax(0, 1fr); }
  .template-auth .registration-sidebar { border-radius: 23px 23px 0 0; }
  .template-auth .form-panel { border-radius: 0 0 23px 23px; }
  .template-auth .portal-registration-intro .portal-icon { display: none; }
  .template-auth .portal-registration-intro h1 { max-width: none; }
  .template-auth .progress li { padding-inline: 6px; }
  .camaba-progress { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 430px) {
  .portal-auth-header .portal-brand { gap: 6px; }
  .portal-auth-header .portal-actions { gap: 5px; }
  .portal-auth-header .portal-actions .button { padding-inline: 8px; text-align: center; }
  .portal-auth-footer .container { flex-wrap: wrap; padding-block: 16px; }
  .template-camaba .admin-avatar { display: none; }
}
