:root{
  /* Align header bar with main/card: same horizontal inset as .wrap */
  /* Use clamp so padding doesn't feel "mobile" on 4K, but still adapts */
  --zh-page-pad-x:clamp(18px, 3vw, 56px);
  /* Constrain content width for readability on large screens */
  --zh-wrap-max:1440px;
  /* Light mode default (shared across all pages) */
  --zh-bg:#f4f6fb;
  --zh-surface:#ffffff;
  --zh-text:#0f172a;
  --zh-muted:#475569;
  --zh-accent:#ff9d00;
  --zh-ok:#22c55e;
  --zh-bad:#ff6b81;

  --zh-card-border:rgba(15,23,42,0.12);
  --zh-card-shadow:0 18px 60px rgba(15,23,42,0.12);

  /* Compatibility aliases (the main pages use --color-*) */
  --color-bg: var(--zh-bg);
  --color-surface: var(--zh-surface);
  --color-card: #ffffff;
  --color-border: rgba(15,23,42,0.12);
  --color-text: var(--zh-text);
  --color-muted: var(--zh-muted);
  --color-highlight: var(--zh-accent);
  --color-button: var(--zh-accent);
  --color-button-text: #0f172a;
  --color-success: var(--zh-ok);
  --color-danger: var(--zh-bad);
}

/* min-height (not height) on both avoids a 1–3px “phantom” vertical scrollbar when
   content fits the viewport — fixed height + margins/sticky/subpixels often overflow slightly. */
html{min-height:100%}
body{
  min-height:100%;
  margin:0;
  font-family:"Nunito",system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  color:var(--zh-text);
  background:
    radial-gradient(1100px 700px at 20% 0%, rgba(255, 157, 0, 0.14) 0%, transparent 55%),
    radial-gradient(900px 650px at 85% 18%, rgba(34, 197, 94, 0.10) 0%, transparent 58%),
    var(--zh-bg);
}

a{color:inherit}

/* Form elements: prevent overflow when width:100% + padding/border */
input, textarea, select, button{
  box-sizing:border-box;
  max-width:100%;
}

/* Simulation mode "red glow" — use a fixed overlay so it’s visible (body box-shadow can be clipped). */
body.sim-glow::before{
  content:"";
  position:fixed;
  inset:10px;
  border-radius:18px;
  pointer-events:none;
  box-shadow:
    inset 0 0 0 2px rgba(255, 107, 129, 0.55),
    0 0 0 6px rgba(255, 107, 129, 0.12),
    0 0 56px rgba(255, 107, 129, 0.32);
  z-index:9999;
}

/* If the main app uses a sticky header, drop it slightly so it sits inside the sim frame. */
body.sim-glow .header-wrapper{
  top: 12px !important;
}

body.sim-glow .card{
  box-shadow:
    var(--zh-card-shadow),
    0 0 44px rgba(255, 107, 129, 0.18);
}

.wrap{
  max-width:var(--zh-wrap-max);
  margin:0 auto;
  /* Keep the same pleasant “header → first card” gap as the homepage.
     The header already has bottom margin, so large top padding here makes other pages feel “pushed down”. */
  padding:0 var(--zh-page-pad-x) 32px;
}
.card{
  background:var(--zh-surface);
  border:1px solid var(--zh-card-border);
  border-radius:16px;
  padding:22px;
  box-shadow:var(--zh-card-shadow);
}

/* Headings: brand orange site-wide in primary content.
   !important beats page-local rules (e.g. superadmin panels, admin sheets, index overlays). */
.wrap h1,
.wrap h2,
.wrap h3,
main h1,
main h2,
main h3,
.zh-sa h1,
.zh-sa h2,
.zh-sa h3,
.success-overlay h1,
.success-overlay h2,
.success-overlay h3,
.sim-modal h1,
.sim-modal h2,
.sim-modal h3,
dialog h1,
dialog h2,
dialog h3,
.zh-domain-detail-sheet h1,
.zh-domain-detail-sheet h2,
.zh-domain-detail-sheet h3,
.zh-user-detail-sheet h1,
.zh-user-detail-sheet h2,
.zh-user-detail-sheet h3,
.zh-admin-detail-sheet h1,
.zh-admin-detail-sheet h2,
.zh-admin-detail-sheet h3,
.zh-unlock-modal h1,
.zh-unlock-modal h2,
.zh-unlock-modal h3{
  color:var(--zh-accent) !important;
}

.muted{color:var(--zh-muted)}
.mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace}

.btn{
  display:inline-block;
  padding:12px 16px;
  border-radius:999px;
  background:var(--zh-accent);
  color:#0b1220;
  text-decoration:none;
  font-weight:800;
  border:1px solid transparent;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
  box-shadow: 0 10px 22px rgba(15,23,42,0.10);
}
.btn.secondary{
  background:transparent;
  color:var(--zh-text);
  border-color:rgba(15,23,42,0.18);
}
.btn:hover,
.btn:focus-visible{
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(15,23,42,0.14);
}
.btn:active{
  transform: translateY(0);
  box-shadow: 0 10px 22px rgba(15,23,42,0.10);
}

.btn.secondary.is-on{
  background:rgba(34,197,94,0.12);
  color:#166534;
  border-color:rgba(34,197,94,0.6);
}

.logo{
  height:64px;
  display:inline-block;
}

/* Shared header (used on all public pages) */
.header-wrapper{
  position:-webkit-sticky;
  position:sticky;
  top:0;
  z-index:5000;
  margin:12px 0 18px 0;
  padding-bottom:10px;
  padding-left:var(--zh-page-pad-x);
  padding-right:var(--zh-page-pad-x);
  box-sizing:border-box;
}

/* Home page: force fixed header on mobile to avoid sticky quirks. */
@media (max-width: 768px) {
  body.zh-force-fixed-header{
    /* JS sets --zh-fixed-header-pad; fallback keeps content usable. */
    padding-top: var(--zh-fixed-header-pad, 110px);
  }
  body.zh-force-fixed-header .header-wrapper{
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    margin: 0;
  }
}
.header-container{
  max-width:var(--zh-wrap-max);
  margin:0 auto;
  padding:14px 18px;
  background:rgba(255,255,255,0.82);
  border:1px solid rgba(15,23,42,0.10);
  border-radius:18px;
  box-shadow: 0 22px 62px rgba(15,23,42,0.14);
  backdrop-filter: blur(8px);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
}
.header-wrapper.scrolled .header-container{
  transform: translateY(2px);
  box-shadow: 0 28px 78px rgba(15,23,42,0.20);
}
.brand-block{display:flex; align-items:center; gap:12px; min-width: 0;}
.brand-copy{display:flex;flex-direction:column;gap:2px;min-width:0}
.brand-title{font-size:1.35rem;font-weight:800;line-height:1.2;color:var(--zh-text)}
.brand-tagline{font-size:0.9rem;font-weight:600;color:var(--zh-muted)}
.brand-text{min-width:0}
.site-title{margin:0; font-size:1.05rem; font-weight:900; line-height:1.2}
.site-tagline{margin:2px 0 0 0; color:var(--zh-muted); font-size:0.92rem}
.header-actions{display:flex; align-items:center; gap:10px}

/* Language switch pill (shared) */
.header-actions .zh-lang-switch{
  margin-left:auto;
  order:999;
}
.zh-lang-switch{
  display:inline-flex;
  align-items:center;
  gap:4px;
  margin-right:6px;
  vertical-align:middle;
  border:1px solid rgba(15, 23, 42, 0.14);
  border-radius:999px;
  padding:2px;
  background: rgba(255,255,255,0.7);
}
.zh-lang-switch a{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:40px;
  min-height:34px;
  padding:0 10px;
  border-radius:999px;
  text-decoration:none !important;
  font-size:1.15rem;
  line-height:1;
  opacity:0.55;
  transition:opacity 0.15s ease, background 0.15s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.zh-lang-switch a:hover{
  opacity:0.95;
  background: rgba(255,157,0,0.12);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(15,23,42,0.10);
}
.zh-lang-switch a:active{
  transform: translateY(0);
  box-shadow: none;
}
.zh-lang-switch a.is-active{
  opacity:1;
  background: rgba(255,157,0,0.22);
  box-shadow: inset 0 0 0 1px rgba(255,157,0,0.35);
}

/* Simulation mode popup */
.sim-modal{
  position:fixed;
  inset:0;
  display:none;
  align-items:center;
  justify-content:center;
  padding:20px;
  z-index:10000;
}
.sim-modal.is-open{display:flex}
.sim-modal__backdrop{
  position:absolute;
  inset:0;
  background:rgba(0,0,0,0.78);
  backdrop-filter: blur(3px);
}
.sim-modal__card{
  position:relative;
  width:min(720px, 96vw);
  /* "Lite" popup: keep dark-theme harmony but reduce heaviness */
  background:rgba(24,24,24,0.96);
  border:1px solid rgba(255, 157, 0, 0.35);
  border-radius:18px;
  box-shadow: 0 28px 90px rgba(0,0,0,0.55), 0 0 60px rgba(255, 157, 0, 0.18);
  padding:18px 18px 16px 18px;
}
.sim-modal__headline{
  margin:10px 0 0 0;
  color:var(--zh-accent) !important;
}
.sim-modal__title{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin:0 0 8px 0;
}
.sim-badge{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:6px 10px;
  border-radius:999px;
  font-weight:900;
  letter-spacing:.2px;
  background:rgba(255, 157, 0, 0.14);
  border:1px solid rgba(255, 157, 0, 0.28);
  color:rgba(255, 195, 120, 0.98);
}
.sim-modal__close{
  background:transparent;
  border:1px solid rgba(15,23,42,0.18);
  color:var(--zh-text);
  border-radius:999px;
  padding:8px 12px;
  font-weight:900;
  cursor:pointer;
}
.sim-modal__list{margin:10px 0 14px 18px; color:var(--zh-muted)}
.sim-modal__actions{display:flex; gap:10px; flex-wrap:wrap; align-items:center}
.sim-modal__hint{color:var(--zh-muted); font-size: 0.95rem}

/* ---- Mobile / touch-friendly layout (iPhone-first) ---- */
html{
  -webkit-text-size-adjust:100%;
  text-size-adjust:100%;
}

.header-nav-toggle{
  display:none;
  flex-shrink:0;
  align-items:center;
  justify-content:center;
  min-width:44px;
  min-height:44px;
  padding:0 14px;
  margin:0;
  border-radius:12px;
  border:1px solid rgba(15,23,42,0.18);
  background:rgba(255,255,255,0.95);
  color:var(--zh-text);
  font:inherit;
  font-weight:800;
  font-size:0.9rem;
  cursor:pointer;
  box-shadow:0 6px 18px rgba(15,23,42,0.08);
}
.header-nav-toggle__icon{display:none; line-height:0;}
.header-nav-toggle__icon svg{display:block}
.header-nav-toggle__text{display:none;}

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

.header-actions .btn{
  font-size:12px;
  padding:8px 12px;
  text-align:center;
  box-sizing:border-box;
}

.header-actions .badge,
.header-actions .badge.small{
  box-sizing:border-box;
}

@media (min-width:769px){
  .header-nav-toggle{display:none !important;}
  .header-nav-drawer{display:contents !important;}
}

@media (max-width:768px){
  :root{
    --zh-page-pad-x:max(14px,4vw);
  }
  /* Mobile: fixed header for reliable “sticky” behavior */
  body{
    padding-top: var(--zh-fixed-header-pad, 110px);
  }
  .wrap{
    padding-top:0;
    padding-bottom:24px;
  }
  .header-wrapper{
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    margin: 0;
    /* Reduce flicker/disappear bugs on some mobile browsers while scrolling */
    transform: translateZ(0);
  }
  .header-container{
    flex-wrap:wrap;
    align-items:center;
    padding:12px 14px;
    gap:10px;
    /* Avoid backdrop-filter scroll bugs on mobile */
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(255,255,255,0.96);
    will-change: transform;
    transform: translateZ(0);
  }
  .brand-block{
    flex:1 1 0;
    min-width:0;
    max-width:none;
  }
  .brand-title{font-size:1.12rem;line-height:1.2}
  .brand-tagline,
  .site-tagline{
    font-size:0.82rem;
    line-height:1.35;
    overflow-wrap:anywhere;
    word-break:break-word;
  }
  .logo{height:48px;width:auto}
  .header-nav-toggle{
    display:inline-flex !important;
    margin-left:auto;
    order:2;
  }
  /* Mobile: always show hamburger icon only */
  .header-nav-toggle{
    min-width:40px;
    min-height:40px;
    padding:0 10px;
  }
  .header-nav-toggle__icon{
    display:inline-flex !important;
    align-items:center;
    justify-content:center;
  }
  .header-nav-drawer{
    display:none;
    flex-basis:100%;
    width:100%;
    order:3;
    flex-direction:column;
    align-items:stretch;
    gap:8px;
    padding-top:10px;
    margin-top:2px;
    border-top:1px solid rgba(15,23,42,0.1);
  }
  .header-nav-drawer.is-open{display:flex !important;}
  .header-actions{
    flex-direction:column;
    align-items:stretch;
    justify-content:flex-start;
    width:100%;
    gap:8px;
  }
  /* Language switch: make it look like a real menu item on mobile */
  .header-actions .zh-lang-switch{
    width:100%;
    justify-content:center;
    margin:0;
    padding:4px;
    box-sizing:border-box;
  }
  .header-actions .zh-lang-switch a{
    flex:1 1 0;
    min-height:44px;
    min-width:0;
    font-size:1.35rem;
    opacity:0.75;
  }
  .header-actions .zh-lang-switch a.is-active{
    opacity:1;
  }
  .header-actions .btn,
  .header-actions .btn.secondary,
  .header-actions a.btn{
    width:100%;
    justify-content:center;
    display:inline-flex;
    align-items:center;
    min-height:44px;
    box-sizing:border-box;
  }
  .header-actions .theme-toggle{
    width:100%;
    min-height:44px;
    justify-content:center;
    display:inline-flex;
    align-items:center;
    box-sizing:border-box;
  }
  .header-actions .badge,
  .header-actions .badge.small,
  .header-actions span.badge{
    display:flex !important;
    width:100%;
    justify-content:center;
    align-items:center;
    text-align:center;
    margin:0 !important;
    padding:10px 12px !important;
    min-height:44px;
    box-sizing:border-box;
  }
  /* Admin toolbars inside mobile drawer */
  .header-nav-drawer .admin-header-right{
    width:100%;
    align-items:stretch !important;
  }
  .header-nav-drawer .admin-header-toolbar{
    justify-content:flex-start !important;
    flex-direction:column;
    align-items:stretch !important;
  }
  .header-nav-drawer .admin-header-toolbar .btn.secondary,
  .header-nav-drawer .admin-header-toolbar .admin-header-toggle{
    width:100%;
    justify-content:center;
    text-align:center;
    min-height:44px;
    display:inline-flex !important;
    align-items:center;
    box-sizing:border-box;
  }
  .header-nav-drawer .admin-header-sep{display:none !important;}
  .card{padding:16px 14px;border-radius:14px;}
}

@media (max-width:640px){
  .brand-title{font-size:1.05rem}
  .logo{height:44px}
}

/* Large screens (desktop/4K): moderately scale typography */
@media (min-width:1400px){
  html{font-size:17px;}
}

/* Very large screens (4K full-width): scale typography further */
@media (min-width:2000px){
  html{font-size:18px;}
}
@media (min-width:2600px){
  html{font-size:19px;}
}

/* 2FA nudge + similar flex rows */
#twofa-nudge{
  flex-wrap:wrap;
}
@media (max-width:768px){
  #twofa-nudge{
    flex-direction:column !important;
    align-items:stretch !important;
  }
  #twofa-nudge > div:last-child{
    width:100%;
    flex-shrink:1;
    flex-direction:column;
    display:flex;
    gap:8px;
  }
  #twofa-nudge > div:last-child .btn{
    width:100%;
    justify-content:center;
    text-align:center;
    min-height:44px;
    display:inline-flex !important;
    align-items:center;
  }
}

/* Site footer (shared across public pages) */
.site-footer{
  margin-top:2.5rem;
  padding:1.75rem 0 2rem;
  border-top:1px solid rgba(15,23,42,0.10);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.45) 0%, rgba(244,246,251,0.95) 100%);
}
.site-footer__inner{
  padding-top:0;
  padding-bottom:0;
}
.site-footer__top{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:1rem 1.5rem;
  margin-bottom:1.25rem;
}
.site-footer__logo-link{
  display:inline-flex;
  flex-shrink:0;
  line-height:0;
  opacity:0.92;
}
.site-footer__logo-link:hover{opacity:1;}
.site-footer__logo{
  height:48px;
  width:auto;
  display:block;
}
.site-footer__intro{
  flex:1 1 200px;
  min-width:0;
}
.site-footer__product{
  margin:0 0 4px 0;
  font-size:0.95rem;
  font-weight:700;
  color:var(--zh-text);
}
.site-footer__zena{
  margin:0;
  font-size:0.88rem;
  line-height:1.45;
}
.site-footer__zena a{
  color:var(--zh-accent);
  font-weight:700;
  text-decoration:none;
}
.site-footer__zena a:hover{text-decoration:underline;}
.site-footer__bottom{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  justify-content:space-between;
  gap:0.75rem 1rem;
  padding-top:1rem;
  border-top:1px solid rgba(15,23,42,0.08);
}
.site-footer__legal{
  margin:0;
  font-size:0.8rem;
  color:var(--zh-muted);
  line-height:1.4;
}
.site-footer__nav{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:0.35rem 0.5rem;
  font-size:0.82rem;
  font-weight:700;
}
.site-footer__nav a{
  color:var(--zh-text);
  text-decoration:none;
}
.site-footer__icon{
  display:none;
  line-height:0;
}
.site-footer__icon svg{display:block}
.site-footer__nav a:hover{
  color:var(--zh-accent);
  text-decoration:underline;
}
.site-footer__sep{
  color:rgba(15,23,42,0.25);
  user-select:none;
}
@media (max-width:768px){
  .site-footer{
    margin-top:2rem;
    padding-top:1.5rem;
    padding-bottom:calc(1.5rem + env(safe-area-inset-bottom,0px));
    border-radius:16px 16px 0 0;
  }
  .site-footer__top{
    flex-direction:column;
    align-items:center;
    text-align:center;
    gap:0.75rem;
    margin-bottom:1.125rem;
  }
  .site-footer__logo{
    height:44px;
  }
  .site-footer__intro{
    flex:none;
    width:100%;
    max-width:22rem;
    margin:0 auto;
  }
  .site-footer__product{
    font-size:0.92rem;
    line-height:1.35;
  }
  .site-footer__zena{
    font-size:0.84rem;
  }
  .site-footer__bottom{
    flex-direction:column;
    align-items:center;
    justify-content:center;
    text-align:center;
    gap:0.875rem;
    padding-top:1rem;
  }
  .site-footer__legal{
    text-align:center;
    font-size:0.76rem;
    line-height:1.55;
    max-width:20rem;
    margin:0 auto;
    overflow-wrap:anywhere;
  }
  .site-footer__nav{
    justify-content:center;
    flex-wrap:nowrap;
    gap:0.2rem 0.45rem;
    max-width:100%;
  }
  .site-footer__sep{display:none;}
  .site-footer__nav a{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-height:40px;
    padding:6px 12px;
    border-radius:10px;
    box-sizing:border-box;
    overflow-wrap:anywhere;
    text-align:center;
  }
  .site-footer__icon{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    width:18px;
    height:18px;
  }
  .site-footer__link-text{
    display:none !important;
  }
  .site-footer__nav a:active{
    background:rgba(15,23,42,0.06);
  }
  body.dark-mode .site-footer__nav a:active{
    background:rgba(255,255,255,0.08);
  }
}

body.dark-mode .site-footer{
  background:linear-gradient(180deg, rgba(40,40,40,0.92) 0%, rgba(24,24,24,0.98) 100%);
  border-top-color:rgba(255,255,255,0.08);
}
body.dark-mode .site-footer__product{color:#e2e8f0;}
body.dark-mode .site-footer__legal{color:#94a3b8;}
body.dark-mode .site-footer__zena{color:#94a3b8;}
body.dark-mode .site-footer__nav a{color:#e2e8f0;}
body.dark-mode .site-footer__nav a:hover{color:var(--zh-accent);}
body.dark-mode .site-footer__sep{color:rgba(255,255,255,0.2);}

