:root {
  color: #1d1730;
  background: #f5f3fb;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  --purple-950: #25164f;
  --purple-700: #5334ba;
  --purple-100: #ece7fb;
  --green: #11865f;
  --green-bg: #e6f7ef;
  --amber: #9a6200;
  --amber-bg: #fff4da;
  --red: #b22b3a;
  --red-bg: #fdecef;
  --line: #e3dfee;
  --muted: #6c657d;
  --shadow: 0 18px 50px rgba(37, 22, 79, .11);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: #f5f3fb; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; }
button, input, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.offline-banner {
  position: fixed;
  z-index: 50;
  inset: 0 0 auto;
  padding: max(10px, env(safe-area-inset-top)) 16px 10px;
  color: #fff;
  background: var(--red);
  text-align: center;
  font-size: 13px;
}

.login-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 28px 18px;
  background:
    radial-gradient(circle at 85% 10%, rgba(100, 74, 207, .18), transparent 32%),
    radial-gradient(circle at 12% 92%, rgba(83, 215, 162, .16), transparent 30%),
    #f5f3fb;
}

.login-card {
  width: min(100%, 440px);
  padding: 34px 26px 28px;
  border: 1px solid rgba(83, 52, 186, .12);
  border-radius: 28px;
  background: rgba(255, 255, 255, .96);
  box-shadow: var(--shadow);
}

.brand-mark {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  color: #fff;
  background: linear-gradient(145deg, #6648d4, var(--purple-950));
  box-shadow: 0 14px 30px rgba(83, 52, 186, .24);
  font-weight: 800;
  letter-spacing: -.5px;
}

h1, h2, h3, p { margin-top: 0; }
.login-card h1 { margin-bottom: 8px; font-size: 30px; }
.eyebrow {
  margin: 22px 0 7px;
  color: var(--purple-700);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.muted { color: var(--muted); }

label { display: block; margin: 18px 0 8px; font-size: 14px; font-weight: 700; }
input, select {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: #1d1730;
  background: #fff;
  outline: none;
}
input:focus, select:focus { border-color: #7257d4; box-shadow: 0 0 0 3px rgba(114, 87, 212, .13); }
.password-field { position: relative; }
.password-field input { padding-right: 72px; }
.password-toggle { position: absolute; top: 5px; right: 6px; min-width: 58px; min-height: 38px; border: 0; border-radius: 11px; color: var(--purple-700); background: var(--purple-100); font-weight: 800; }
.check-row { display: flex; align-items: center; gap: 10px; font-weight: 500; color: var(--muted); }
.check-row input { width: 20px; min-height: 20px; accent-color: var(--purple-700); }

.primary-button, .secondary-button, .danger-button, .ghost-button {
  min-height: 46px;
  padding: 0 18px;
  border-radius: 14px;
  border: 0;
  font-weight: 800;
  cursor: pointer;
}
.primary-button { width: 100%; color: #fff; background: linear-gradient(135deg, #6548d0, var(--purple-950)); }
.secondary-button { color: var(--purple-950); background: var(--purple-100); }
.danger-button { color: #fff; background: var(--red); }
.ghost-button { min-height: 38px; padding: 0 13px; color: var(--purple-700); background: #f5f2ff; }
.full-button { width: 100%; }
button:disabled { opacity: .48; cursor: not-allowed; }
.form-error { margin: 14px 0 0; color: var(--red); font-size: 14px; }
.privacy-note { margin: 20px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }

.app-shell { min-height: 100vh; min-height: 100dvh; padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: calc(14px + env(safe-area-inset-top)) 18px 14px;
  border-bottom: 1px solid rgba(227, 223, 238, .9);
  background: rgba(245, 243, 251, .92);
  backdrop-filter: blur(18px);
}
.topbar .eyebrow { margin: 0 0 3px; }
.topbar h1 { margin: 0; font-size: 25px; }
.connection-pill { display: flex; align-items: center; gap: 7px; padding: 8px 11px; border-radius: 99px; color: var(--muted); background: #fff; font-size: 12px; font-weight: 700; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #aaa; }
.connection-pill.online { color: var(--green); background: var(--green-bg); }
.connection-pill.online .status-dot { background: #20b881; box-shadow: 0 0 0 4px rgba(32,184,129,.12); }
.connection-pill.offline { color: var(--red); background: var(--red-bg); }
.connection-pill.offline .status-dot { background: var(--red); }

.content { width: min(100%, 920px); margin: 0 auto; padding: 18px 16px 34px; }
.mobile-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.summary-tile { min-width: 0; padding: 15px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.summary-tile strong { display: block; font-size: 24px; color: var(--purple-950); }
.summary-tile span { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.module-link { position: relative; min-height: 112px; padding-right: 42px; cursor: pointer; }
.module-link::after { content: "›"; position: absolute; top: 50%; right: 18px; transform: translateY(-50%); color: var(--purple-700); font-size: 30px; }
.module-link:active { transform: scale(.985); }
.module-kicker { margin-bottom: 8px; color: var(--purple-700); font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.notice-card { padding: 14px 16px; border: 1px solid #eadfb8; border-radius: 16px; color: #72520c; background: #fff9e9; font-size: 13px; line-height: 1.55; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 12px 2px; }
.section-heading h2 { margin: 0; font-size: 20px; }
.section-heading p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }

.hero-card {
  padding: 22px;
  border-radius: 24px;
  color: #fff;
  background: linear-gradient(140deg, #6649d6, #25164f 72%);
  box-shadow: 0 20px 44px rgba(37, 22, 79, .19);
}
.hero-card h2 { margin-bottom: 7px; font-size: 24px; }
.hero-card p { margin: 0; color: rgba(255,255,255,.74); }
.hero-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 20px; }
.hero-metric { padding: 13px 10px; border-radius: 16px; background: rgba(255,255,255,.11); }
.hero-metric strong { display: block; font-size: 21px; }
.hero-metric span { color: rgba(255,255,255,.72); font-size: 11px; }

.grid { display: grid; gap: 13px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(37, 22, 79, .045);
}
.card h3 { margin-bottom: 5px; font-size: 17px; }
.card p { margin-bottom: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.stack { display: grid; gap: 13px; }
.spacer { height: 8px; }

.metric { font-size: 28px; font-weight: 800; color: var(--purple-950); }
.badge { display: inline-flex; align-items: center; min-height: 27px; padding: 0 10px; border-radius: 99px; font-size: 12px; font-weight: 800; }
.badge.good { color: var(--green); background: var(--green-bg); }
.badge.warn { color: var(--amber); background: var(--amber-bg); }
.badge.bad { color: var(--red); background: var(--red-bg); }
.badge.neutral { color: var(--muted); background: #f0eef5; }

.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.switch {
  position: relative;
  flex: 0 0 auto;
  width: 52px;
  height: 30px;
  border: 0;
  border-radius: 99px;
  background: #cfcad9;
  cursor: pointer;
}
.switch::after { content: ""; position: absolute; top: 4px; left: 4px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 7px rgba(0,0,0,.2); transition: transform .18s ease; }
.switch.on { background: #6a4bd1; }
.switch.on::after { transform: translateX(22px); }

.list-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 0; border-bottom: 1px solid #eeeaf5; }
.list-row:last-child { border-bottom: 0; }
.list-main { min-width: 0; }
.list-main strong { display: block; overflow-wrap: anywhere; }
.list-main span { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.actions select { flex: 1 1 150px; min-height: 40px; }

.empty-state { padding: 44px 20px; border: 1px dashed #d6d0e5; border-radius: 20px; text-align: center; color: var(--muted); background: rgba(255,255,255,.6); }
.loading { display: grid; place-items: center; min-height: 44vh; color: var(--muted); }
.spinner { width: 30px; height: 30px; margin-bottom: 12px; border: 3px solid #ddd7ee; border-top-color: var(--purple-700); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.bottom-nav {
  position: fixed;
  z-index: 30;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  padding: 8px 7px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(18px);
}
.nav-item { min-height: 54px; border: 0; border-radius: 14px; color: #81798f; background: transparent; font-size: 11px; font-weight: 700; cursor: pointer; touch-action: manipulation; }
.nav-icon { display: block; margin-bottom: 2px; font-size: 18px; font-weight: 900; }
.nav-item.active { color: var(--purple-700); background: #f0ecfb; }

.toast { position: fixed; z-index: 80; right: 18px; bottom: calc(92px + env(safe-area-inset-bottom)); left: 18px; max-width: 520px; margin: auto; padding: 14px 16px; border-radius: 14px; color: #fff; background: #2f2840; box-shadow: var(--shadow); text-align: center; font-size: 14px; }
.confirm-dialog { width: min(calc(100% - 32px), 420px); padding: 0; border: 0; border-radius: 22px; box-shadow: 0 24px 80px rgba(20,13,45,.3); }
.confirm-dialog::backdrop { background: rgba(25,17,48,.5); backdrop-filter: blur(4px); }
.confirm-dialog form { padding: 24px; }
.confirm-dialog h2 { margin-bottom: 8px; }
.confirm-dialog p { color: var(--muted); line-height: 1.6; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }

.invite-result { margin-top: 14px; padding: 14px; border: 1px solid #cfc5ef; border-radius: 14px; background: #f5f1ff; }
.invite-code { display: block; margin: 8px 0 12px; overflow-wrap: anywhere; color: var(--purple-950); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.small { font-size: 12px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.growth-command-form{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-bottom:16px}.growth-command-form>h3,.growth-command-form>p,.growth-command-form>fieldset,.growth-command-form>label:has(textarea),.growth-command-form>button{grid-column:1/-1}.growth-command-form>label{display:grid;gap:6px;color:var(--muted);font-size:13px;font-weight:700}.growth-command-form input,.growth-command-form textarea{width:100%;min-height:44px;padding:11px;border:1px solid var(--line);border-radius:12px;background:#fff;font:inherit}.growth-command-form textarea{resize:vertical}.growth-command-form fieldset{display:flex;flex-wrap:wrap;gap:8px;padding:12px;border:1px solid var(--line);border-radius:14px}.growth-command-form legend{padding:0 5px;font-weight:800}.growth-command-form fieldset label{display:flex;align-items:center;gap:5px;padding:7px 9px;border-radius:9px;background:#f5f2fb;font-size:12px;font-weight:700}
.ad-task-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.ad-task-meta div { padding: 10px; border-radius: 12px; background: #f7f5fa; }
.ad-task-meta strong { display: block; font-size: 16px; }
.ad-task-meta span { color: var(--muted); font-size: 11px; }

@media (min-width: 760px) {
  .content { padding: 26px 24px 42px; }
  .bottom-nav { right: auto; top: 0; width: 112px; grid-template-columns: 1fr; align-content: center; border-top: 0; border-right: 1px solid var(--line); }
  .app-shell { padding: 0 0 0 112px; }
  .topbar { padding-left: 28px; padding-right: 28px; }
  .toast { left: 130px; }
}

@media (max-width: 430px) {
  .grid.two { grid-template-columns: 1fr; }
  .growth-command-form{grid-template-columns:1fr}.growth-command-form>*{grid-column:1!important}
  .hero-metrics { gap: 7px; }
  .hero-metric { padding: 11px 7px; }
  .hero-metric strong { font-size: 19px; }
}

@media (max-width: 360px) {
  .content { padding-right: 12px; padding-left: 12px; }
  .topbar { padding-right: 13px; padding-left: 13px; }
  .connection-pill { padding: 7px 8px; }
  .nav-item { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
.login-logo { display: block; width: min(270px, 82%); height: auto; margin: 0 auto 18px; object-fit: contain; }
.login-card { position: relative; overflow: hidden; }
.login-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 6px; background: linear-gradient(90deg, #ef8225, #0c9a82); }
