:root {
  --app-bg: #f4f7ff;
  --app-bg-soft: #eef3ff;
  --app-surface: rgba(255, 255, 255, 0.9);
  --app-card: #ffffff;
  --app-card-elevated: #ffffff;
  --app-border: #dbe3f5;
  --app-text: #0f172a;
  --app-text-muted: #64748b;
  --app-primary: #7c3aed;
  --app-primary-2: #22d3ee;
  --app-primary-soft: rgba(124, 58, 237, 0.16);
  --app-success: #22c55e;
  --app-danger: #ef4444;
  --app-warning: #f59e0b;
  --app-radius: 18px;
  --app-shadow: 0 18px 50px rgba(15, 23, 42, 0.12);
}

html[data-theme='dark'] {
  --app-bg: #000000;
  --app-bg-soft: #0b0b0b;
  --app-surface: rgba(8, 8, 8, 0.92);
  --app-card: rgba(15, 15, 15, 0.96);
  --app-card-elevated: rgba(22, 22, 22, 0.96);
  --app-border: rgba(255, 255, 255, 0.12);
  --app-text: #f1f5f9;
  --app-text-muted: rgba(203, 213, 225, 0.78);
  --app-shadow: 0 24px 80px rgba(0, 0, 0, 0.75);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  color: var(--app-text);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  background: #f3f6fb;
}

html[data-theme='dark'] body {
  background: #000000;
}

.main, .sidebar, .topbar { position: relative; z-index: 1; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--app-primary); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--app-border);
  background: var(--app-surface);
  backdrop-filter: blur(12px);
}

.topbar__left { display: flex; align-items: center; gap: 14px; min-width: 0; flex: 1; }
.topbar__right { display: flex; align-items: center; gap: 10px; }
.theme-toggle { display: inline-flex; align-items: center; gap: 6px; }
.theme-toggle__icon { padding: 8px 10px; border-radius: 999px; }

.brand { display: flex; align-items: center; gap: 10px; }
.brand__logo {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  color: #fff; font-weight: 800;
  background: linear-gradient(135deg, #0ea5e9, #22d3ee);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.35);
}
.brand__name { font-weight: 800; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 12px; border: 1px solid var(--app-border); background: var(--app-card-elevated); color: var(--app-text); cursor: pointer; font-size: 14px; font-weight: 700; padding: 10px 14px; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 25px rgba(15, 23, 42, 0.12); }
.btn--ghost, .btn-ghost { background: transparent; }
.btn--small { font-size: 12px; padding: 8px 10px; }

/* Topbar auth buttons */
.topbar .btn--primary {
  border-color: #ffffff !important;
  background: #ffffff !important;
  background-image: none !important;
  color: #0b0b0b !important;
}

.topbar .btn--primary:hover {
  background: #f3f4f6 !important;
  border-color: #f3f4f6 !important;
  color: #0b0b0b !important;
}

/* Keep generic primary usable outside topbar */
.btn--primary, .btn-primary { color: #fff; border-color: #0f172a; background: #0f172a; }

.chip { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; border-radius: 999px; border: 1px solid var(--app-border); background: var(--app-card-elevated); padding: 7px 12px; }
.chip--balance { color: var(--app-primary); background: var(--app-primary-soft); }

.user { position: relative; border: 1px solid var(--app-border); border-radius: 12px; background: var(--app-card-elevated); padding: 8px 12px; cursor: pointer; }
.user__name { font-size: 14px; font-weight: 700; }
.user__menu { position: absolute; top: calc(100% + 8px); right: 0; min-width: 190px; border: 1px solid var(--app-border); border-radius: 12px; background: var(--app-card); box-shadow: var(--app-shadow); display: none; z-index: 50; overflow: hidden; }
.user:hover .user__menu { display: block; }
.user__menu a { display: block; padding: 10px 12px; font-size: 14px; }
.user__menu a:hover { background: var(--app-bg-soft); }
.user__menu .danger { color: var(--app-danger); }

.topbar--home { gap: 12px; padding: 12px 24px; }
.topbar--home .topbar__left { gap: 12px; }
.home-nav { display: inline-flex; align-items: center; gap: 6px; margin-left: 8px; }
.home-nav__link { padding: 8px 12px; border-radius: 10px; color: #475569; font-size: 15px; font-weight: 600; }
.home-nav__link:hover, .home-nav__link--active { background: #f1f5f9; color: #0f172a; }

.home-search {
  margin-left: 12px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  max-width: 460px;
  height: 46px;
  border: 1px solid #d9e0e8;
  border-radius: 14px;
  padding: 0 14px;
  background: #f3f5f8;
  transition: border-color .2s ease, background .2s ease;
}
.home-search:focus-within { border-color: #94a3b8; background: #ffffff; }
.home-search i { color: #94a3b8; font-size: 14px; }
.home-search input {
  all: unset;
  width: 100%;
  background: transparent !important;
  color: #0f172a;
  font-size: 15px;
  line-height: 1.2;
}
.home-search input[type='search']::-webkit-search-decoration,
.home-search input[type='search']::-webkit-search-cancel-button,
.home-search input[type='search']::-webkit-search-results-button,
.home-search input[type='search']::-webkit-search-results-decoration {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}

.home-main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px;
}

.zhome-hero { display: grid; grid-template-columns: 1.4fr .8fr; gap: 14px; margin-bottom: 14px; }
.zhome-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 18px; box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05); padding: 20px; transition: transform .24s ease, box-shadow .24s ease, border-color .24s ease; position: relative; overflow: hidden; }
.zhome-card:hover { transform: translateY(-2px); border-color: #d2dbe5; box-shadow: 0 14px 32px rgba(15, 23, 42, 0.08); }
.zhome-card--intro { grid-row: span 2; min-height: 310px; }
.zhome-kicker { display: inline-flex; padding: 6px 10px; border-radius: 999px; border: 1px solid #dbe2ea; font-size: 11px; letter-spacing: .06em; font-weight: 700; color: #475569; }
.zhome-title { margin: 14px 0 10px; font-size: clamp(32px, 4.5vw, 54px); line-height: 1.02; letter-spacing: -0.03em; color: #0f172a; max-width: 780px; }
.zhome-desc { margin: 0; color: #5b677b; max-width: 720px; font-size: 18px; line-height: 1.6; }
.zhome-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.zhome-tags { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.zhome-tags span { display: inline-flex; padding: 5px 10px; border-radius: 999px; border: 1px solid #dbe2ea; background: #f8fafc; color: #475569; font-size: 12px; }
.zbtn { display: inline-flex; align-items: center; justify-content: center; min-width: 170px; height: 46px; border-radius: 12px; font-size: 16px; font-weight: 700; border: 1px solid #d1d5db; }
.zbtn--dark { background: #ffffff; color: #0f172a; border-color: #d1d5db; }
.zbtn--light { background: #0f172a; color: #ffffff; border-color: #1f2937; }
.zhome-card--stats h3, .zhome-card--trust h3 { margin: 0 0 12px; font-size: 18px; }
.zhome-statlist { display: grid; grid-template-columns: 1fr; gap: 10px; }
.zhome-statlist div { border: 1px solid #e5e7eb; border-radius: 12px; padding: 10px 12px; }
.zhome-statlist strong { display: block; font-size: 26px; line-height: 1; color: #0f172a; }
.zhome-statlist span { color: #64748b; font-size: 14px; }
.zhome-card--trust ul { margin: 0; padding-left: 18px; color: #475569; display: grid; gap: 8px; }
.zhome-inline-link { display: inline-flex; margin-top: 12px; font-weight: 700; color: #0f172a; border-bottom: 1px solid #cbd5e1; }
.zhome-about, .zhome-contact, .zhome-services, .zhome-products { margin-top: 14px; }
.zhome-head { margin-bottom: 14px; }
.zhome-head h2 { margin: 0; font-size: 30px; letter-spacing: -0.02em; }
.zhome-head p { margin: 8px 0 0; color: #64748b; }
.zhome-head--row { display: flex; justify-content: space-between; align-items: center; }
.zhome-about-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.zhome-about-grid article { border: 1px solid #e5e7eb; border-radius: 14px; padding: 14px; }
.zhome-about-grid h4 { margin: 0 0 8px; font-size: 18px; }
.zhome-about-grid p { margin: 0; color: #64748b; line-height: 1.6; }
.zhome-about-grid ul { margin: 0; padding-left: 18px; color: #64748b; display: grid; gap: 6px; }
.zhome-contact-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.zhome-contact-grid article { border: 1px solid #e5e7eb; border-radius: 14px; padding: 14px; }
.zhome-contact-grid .label { display: block; font-size: 12px; color: #64748b; margin-bottom: 6px; }
.zhome-contact-grid strong { font-size: 18px; color: #0f172a; }
.zhome-service-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.zhome-service-grid article { border: 1px solid #e5e7eb; border-radius: 14px; padding: 14px; }
.zhome-service-grid i { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: #f1f5f9; color: #0f172a; }
.zhome-service-grid h4 { margin: 10px 0 6px; font-size: 18px; }
.zhome-service-grid p { margin: 0; color: #64748b; line-height: 1.55; }
.zhome-product-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.zhome-product { border: 1px solid #e5e7eb; border-radius: 14px; overflow: hidden; }
.zhome-product__thumb { display: block; height: 130px; background-size: cover; background-position: center; }
.zhome-product__body { padding: 10px; }
.zhome-product__body h4 { margin: 0; font-size: 15px; line-height: 1.35; }
.zhome-product__meta { margin-top: 8px; display: flex; justify-content: space-between; color: #64748b; font-size: 13px; }
.zhome-product__meta strong { color: #0f172a; }

.z-animate { opacity: 0; transform: translateY(18px); transition: opacity .55s ease, transform .55s ease; }
.z-animate.is-visible { opacity: 1; transform: translateY(0); }

html[data-theme='dark'] .topbar {
  background: rgba(10, 10, 10, 0.94);
  border-bottom-color: rgba(255, 255, 255, 0.12);
}
html[data-theme='dark'] .home-nav__link { color: #cbd5e1; }
html[data-theme='dark'] .home-nav__link:hover,
html[data-theme='dark'] .home-nav__link--active { background: rgba(255, 255, 255, 0.08); color: #ffffff; }
html[data-theme='dark'] .home-search { background: #111111; border-color: rgba(255, 255, 255, 0.16); }
html[data-theme='dark'] .home-search i,
html[data-theme='dark'] .home-search input { color: #e2e8f0; }

html[data-theme='dark'] .zhome-card,
html[data-theme='dark'] .zhome-about-grid article,
html[data-theme='dark'] .zhome-contact-grid article,
html[data-theme='dark'] .zhome-service-grid article,
html[data-theme='dark'] .zhome-statlist div,
html[data-theme='dark'] .zhome-product {
  background: #101010;
  border-color: rgba(255, 255, 255, 0.12);
  color: #f1f5f9;
}
html[data-theme='dark'] .zhome-title,
html[data-theme='dark'] .zhome-head h2,
html[data-theme='dark'] .zhome-card h3,
html[data-theme='dark'] .zhome-card h4,
html[data-theme='dark'] .zhome-product__meta strong,
html[data-theme='dark'] .zhome-contact-grid strong,
html[data-theme='dark'] .zhome-statlist strong { color: #f8fafc !important; }
html[data-theme='dark'] .zhome-desc,
html[data-theme='dark'] .zhome-head p,
html[data-theme='dark'] .zhome-card p,
html[data-theme='dark'] .zhome-card li,
html[data-theme='dark'] .zhome-product__meta,
html[data-theme='dark'] .zhome-statlist span,
html[data-theme='dark'] .zhome-contact-grid .label { color: #cbd5e1; }
html[data-theme='dark'] .zhome-kicker,
html[data-theme='dark'] .zhome-tags span {
  background: #0f1510;
  border-color: #22c55e;
  color: #86efac;
}
html[data-theme='dark'] .zhome-inline-link { color: #f8fafc; border-bottom-color: rgba(255, 255, 255, 0.4); }
html[data-theme='dark'] .zbtn--dark { background: #ffffff; color: #0b0b0b; border-color: #ffffff; }
html[data-theme='dark'] .zbtn--light { background: #111111; color: #f8fafc; border-color: rgba(255, 255, 255, 0.26); }
html[data-theme='dark'] .zbtn--dark:hover,
html[data-theme='dark'] .zbtn--light:hover { filter: brightness(1.06); }
html[data-theme='dark'] .topbar .btn--primary {
  border-color: #ffffff !important;
  background: #ffffff !important;
  color: #0b0b0b !important;
}
html[data-theme='dark'] .topbar .btn--primary:hover {
  background: #f3f4f6 !important;
  border-color: #f3f4f6 !important;
}

@media (max-width: 1080px) {
  .home-main { padding: 24px 14px 50px; }
  .home-nav { display: none; }
  .home-search { max-width: 280px; }
  .zhome-hero { grid-template-columns: 1fr; }
  .zhome-card--intro { grid-row: auto; }
  .zhome-about-grid,
  .zhome-contact-grid,
  .zhome-service-grid,
  .zhome-product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .topbar { padding: 10px 12px; }
  .brand__name, .chip__label { display: none; }
  .topbar--home { padding: 10px 12px; }
  .home-search { display: none; }
  .zhome-title { font-size: 34px; }
  .zhome-desc { font-size: 16px; }
  .zhome-actions { flex-direction: column; }
  .zbtn { width: 100%; }
  .zhome-about-grid,
  .zhome-contact-grid,
  .zhome-service-grid,
  .zhome-product-grid { grid-template-columns: 1fr; }
  .zhome-head h2 { font-size: 24px; }
}
