:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --border: #e6ebf5;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #1d6ef5;
  --primary-hover: #1558d6;
  --indigo: #4f46e5;
  --orange: #ff7a1a;
  --green: #16a34a;
  --red: #dc2626;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Topbar */
.mc-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255,255,255,0.92); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.mc-header-inner {
  max-width: 1320px; margin: 0 auto; padding: 0 24px; height: 64px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.mc-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16px; color: #0f172a; text-decoration: none !important; }
.mc-brand img { width: 32px; height: 32px; border-radius: 9px; box-shadow: 0 2px 8px rgba(29,110,245,0.2); }
.mc-brand-tag { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #eff6ff; color: var(--primary); }
.mc-nav-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 10px; font-size: 13px; font-weight: 600;
  cursor: pointer; border: 1px solid transparent; transition: all 0.16s ease;
  font-family: inherit; text-decoration: none !important; white-space: nowrap;
}
.btn-primary { background: linear-gradient(135deg, #2563eb, #4f46e5); color: #fff; box-shadow: 0 4px 14px rgba(37,99,235,0.22); }
.btn-primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn-secondary { background: #fff; color: #334155; border-color: #dbe3f0; }
.btn-secondary:hover { background: #f8fafc; border-color: #cbd5e1; }
.btn-orange { background: linear-gradient(135deg, #ff7a1a, #ff5722); color: #fff; box-shadow: 0 4px 12px rgba(255,122,26,0.25); }
.btn-orange:hover { filter: brightness(1.05); }
.btn-danger { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none !important; }

/* Main container */
.mc-container { max-width: 1320px; margin: 22px auto 60px; padding: 0 24px; }

/* Full-Screen Split Auth Page (Left Logo + Brochure, Right Email-Only Auth) */
body.auth-fullscreen .mc-header { display: none; }
.auth-split {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(460px, 1.16fr) minmax(400px, 0.84fr);
}
.auth-showcase {
  position: relative; overflow: hidden;
  background: linear-gradient(145deg, #09132a 0%, #10244c 48%, #18397a 100%);
  color: #fff; padding: 34px 44px 28px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 22px;
}
.auth-showcase-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; position: relative; z-index: 2; }
.auth-logo-card { display: inline-flex; align-items: center; background: #fff; padding: 7px 16px; border-radius: 13px; box-shadow: 0 10px 28px rgba(0,0,0,0.22); }
.auth-logo-card img { height: 36px; width: auto; display: block; }
.auth-ver-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 13px; border-radius: 999px;
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.18);
  font-size: 12px; font-weight: 600; color: #e2edff;
}
.auth-ver-dot { width: 8px; height: 8px; border-radius: 50%; background: #ff8a3d; box-shadow: 0 0 0 4px rgba(255,138,61,0.24); }
.brochure-stage { position: relative; z-index: 2; flex: 1; display: flex; flex-direction: column; justify-content: center; max-width: 600px; width: 100%; margin: 0 auto; }
.brochure-slide { display: none; flex-direction: column; gap: 20px; }
.brochure-slide.active { display: flex; animation: authSlideIn 0.35s ease; }
@keyframes authSlideIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.mock-board {
  position: relative; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.16);
  border-radius: 18px; padding: 16px 18px 18px; backdrop-filter: blur(12px);
  box-shadow: 0 22px 44px rgba(4,12,32,0.34);
}
.mock-board-hd { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid rgba(255,255,255,0.1); font-size: 12px; font-weight: 600; color: rgba(255,255,255,0.88); }
.mock-kpi-row { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; margin-bottom: 12px; }
.mock-kpi { background: rgba(10,22,48,0.48); border: 1px solid rgba(255,255,255,0.1); border-radius: 11px; padding: 9px 10px; }
.mock-kpi small { display: block; font-size: 11px; color: #93c5fd; margin-bottom: 3px; }
.mock-kpi strong { font-size: 17px; color: #fff; }
.mock-health-box { background: rgba(10,22,48,0.42); border-radius: 11px; padding: 11px 13px; max-width: 78%; font-size: 11.5px; }
.mh-bar { height: 7px; background: rgba(255,255,255,0.12); border-radius: 99px; overflow: hidden; margin-top: 5px; }
.mh-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg,#38bdf8,#2563eb); }
.mock-mascot-float { position: absolute; right: 14px; bottom: 10px; width: 88px; height: 88px; object-fit: contain; filter: drop-shadow(0 10px 18px rgba(0,0,0,0.35)); }
.mock-bars { height: 104px; display: flex; align-items: flex-end; gap: 9px; padding: 6px; background: rgba(10,22,48,0.42); border-radius: 11px; margin-bottom: 10px; }
.mbar-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.mbar-col span { width: 100%; max-width: 26px; border-radius: 5px 5px 2px 2px; background: linear-gradient(180deg,#60a5fa,#2563eb); }
.mbar-col span.peak { background: linear-gradient(180deg,#ffb26b,#ff7a1a); }
.mbar-col i { font-style: normal; font-size: 10px; color: rgba(255,255,255,0.65); }
.mq-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: rgba(10,22,48,0.45); border: 1px solid rgba(255,255,255,0.09); border-radius: 10px; padding: 9px 12px; margin-bottom: 8px; font-size: 12px; }
.slide-kicker { display: inline-block; font-size: 11.5px; font-weight: 700; color: #ffb26b; letter-spacing: 0.7px; margin-bottom: 6px; }
.brochure-slide h2 { margin: 0 0 8px; font-size: 24px; line-height: 1.32; color: #fff; }
.brochure-slide p { margin: 0; font-size: 13.5px; line-height: 1.68; color: rgba(226,232,240,0.85); }
.brochure-ctrls { margin-top: 20px; display: flex; align-items: center; justify-content: space-between; }
.brochure-dots { display: flex; gap: 8px; }
.b-dot { width: 10px; height: 6px; border-radius: 99px; border: none; padding: 0; cursor: pointer; background: rgba(255,255,255,0.28); transition: all 0.2s; }
.b-dot.active { width: 28px; background: linear-gradient(90deg,#ff8a3d,#60a5fa); }
.b-arrow { width: 32px; height: 32px; border-radius: 9px; border: 1px solid rgba(255,255,255,0.2); background: rgba(255,255,255,0.08); color: #fff; font-size: 17px; cursor: pointer; }
.auth-showcase-foot { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding-top: 14px; border-top: 1px solid rgba(255,255,255,0.12); font-size: 12.5px; }
.auth-form-panel { background: #fff; display: flex; align-items: center; justify-content: center; padding: 32px 36px; overflow-y: auto; }
.auth-form-inner { width: 100%; max-width: 400px; }
.auth-tabs { display: flex; gap: 6px; background: #f1f5f9; padding: 4px; border-radius: 11px; margin-bottom: 20px; }
.auth-tab {
  flex: 1; text-align: center; padding: 8px 10px; border-radius: 8px; border: none;
  background: transparent; font-weight: 700; font-size: 13px; color: #64748b; cursor: pointer;
}
.auth-tab.active { background: #fff; color: var(--primary); box-shadow: 0 2px 6px rgba(15,23,42,0.06); }
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12.5px; font-weight: 700; color: #334155; margin-bottom: 5px; }
.form-control {
  width: 100%; padding: 10px 12px; border: 1px solid #d5deec; border-radius: 10px;
  font-size: 13.5px; color: #0f172a; background: #fff; outline: none; font-family: inherit;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29,110,245,0.12); }
.alert-box { padding: 10px 12px; border-radius: 10px; font-size: 12.5px; margin-bottom: 14px; display: none; }
.alert-err { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-ok  { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }

/* Journey Hero (Matching Screenshot) */
.journey-hero {
  background: linear-gradient(125deg, #0b1636 0%, #1c2c6b 48%, #323c8a 100%);
  border-radius: 18px; padding: 24px 28px; color: #fff;
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  box-shadow: 0 14px 36px rgba(15,27,51,0.18); margin-bottom: 16px;
}
.jh-left { display: flex; align-items: center; gap: 16px; }
.jh-avatar {
  width: 54px; height: 54px; border-radius: 50%; background: rgba(255,255,255,0.16);
  border: 2px solid rgba(255,255,255,0.28); display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 800; color: #fff; overflow: hidden; flex-shrink: 0;
}
.jh-avatar img { width: 100%; height: 100%; object-fit: cover; }
.jh-eyebrow { font-size: 11px; letter-spacing: 1px; font-weight: 700; color: #93c5fd; text-transform: uppercase; }
.jh-title { font-size: 24px; font-weight: 800; margin: 2px 0 4px; }
.jh-sub { font-size: 12.5px; color: rgba(255,255,255,0.78); }
.jh-right-card {
  background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.18);
  border-radius: 14px; padding: 14px 20px; min-width: 240px; backdrop-filter: blur(8px);
}
.jh-rc-label { font-size: 11.5px; color: rgba(255,255,255,0.72); }
.jh-rc-big { font-size: 20px; font-weight: 800; margin: 3px 0; }
.jh-rc-sub { font-size: 12px; color: #bfdbfe; }

/* Range Filter Bar */
.range-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.range-pills { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.range-pill {
  padding: 6px 14px; border-radius: 9px; border: 1px solid var(--border);
  background: #fff; color: #475569; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.range-pill.active { background: #1d6ef5; color: #fff; border-color: #1d6ef5; box-shadow: 0 3px 10px rgba(29,110,245,0.22); }
.custom-dates { display: none; align-items: center; gap: 6px; }
.custom-dates.open { display: inline-flex; }
.custom-dates input { padding: 5px 8px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 12px; }

/* KPI Grids */
.kpi-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 12px; }
.kpi-grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 13px;
  padding: 15px 18px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.kpi-card-top { align-items: center; justify-content: flex-start; gap: 12px; }
.kpi-ico {
  width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-size: 16px; background: #eff6ff; color: var(--primary); flex-shrink: 0;
}
.kpi-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.kpi-val { font-size: 22px; font-weight: 800; color: #0f172a; line-height: 1.2; }
.kpi-card-inline { padding: 14px 18px; }
.kpi-card-inline .kpi-val { font-size: 19px; }

/* 2-Col Middle Cards */
.mid-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.panel {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 18px 20px; box-shadow: 0 4px 16px rgba(15,23,42,0.025);
}
.panel-eyebrow { font-size: 11px; font-weight: 700; color: #94a3b8; margin-bottom: 2px; }
.panel-title { font-size: 16px; font-weight: 800; color: #0f172a; margin: 0 0 14px; display: flex; align-items: center; justify-content: space-between; }

/* Module ranking list */
.mod-list { display: flex; flex-direction: column; gap: 8px; }
.mod-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border-radius: 11px; background: #f8fafc; border: 1px solid #eef2f8;
}
.mod-rank {
  width: 24px; height: 24px; border-radius: 7px; background: #eef2ff; color: #4f46e5;
  font-size: 12px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center;
}
.mod-name { font-weight: 700; font-size: 13.5px; color: #1e293b; flex: 1; }
.mod-cnt { font-size: 12.5px; font-weight: 700; color: #64748b; }

/* FB Identities List */
.fb-list { display: flex; flex-direction: column; gap: 8px; max-height: 292px; overflow-y: auto; padding-right: 4px; }
.fb-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border-radius: 11px; background: #f8fafc; border: 1px solid #eef2f8;
  cursor: pointer; transition: all 0.14s;
}
.fb-row:hover { border-color: #93c5fd; background: #eff6ff; }
.fb-row.active { border-color: #1d6ef5; background: #eff6ff; box-shadow: 0 0 0 2px rgba(29,110,245,0.12); }
.fb-avatar { width: 36px; height: 36px; border-radius: 50%; background: #e2e8f0; object-fit: cover; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #475569; overflow: hidden; }
.fb-avatar img { width: 100%; height: 100%; object-fit: cover; }
.fb-info { flex: 1; min-width: 0; }
.fb-name { font-weight: 700; font-size: 13.5px; color: #0f172a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fb-id { font-size: 11.5px; color: #64748b; font-family: ui-monospace, monospace; }
.fb-meta { font-size: 11.5px; color: #64748b; text-align: right; white-space: nowrap; }

/* Section Tabs */
.sec-tabs { display: flex; gap: 8px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.sec-tab {
  padding: 9px 14px; font-weight: 700; font-size: 13.5px; color: #64748b; cursor: pointer;
  border: none; background: transparent; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.sec-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Filter row & Table */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filter-bar select, .filter-bar input {
  padding: 8px 11px; border: 1px solid #d5deec; border-radius: 9px; font-size: 13px; background: #fff; color: #0f172a;
}
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; min-width: 780px; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid #eef2f8; font-size: 13px; }
th { background: #f8fafc; font-weight: 700; color: #475569; font-size: 12px; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafcff; }
.type-pill {
  display: inline-block; padding: 3px 9px; border-radius: 8px; font-size: 11.5px; font-weight: 700;
  border: 1px solid #dbe3f0; background: #f8fafc; color: #334155; white-space: nowrap;
}
.type-bm { background: #eef2ff; border-color: #c7d2fe; color: #4338ca; }
.type-ad_account { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.type-page { background: #fff7ed; border-color: #fed7aa; color: #c2410c; }
.type-pixel { background: #faf5ff; border-color: #e9d5ff; color: #7e22ce; }
.note-btn {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: #64748b;
  background: none; border: none; padding: 2px 0; cursor: pointer; margin-top: 2px;
}
.note-btn:hover { color: var(--primary); }
.note-text { font-size: 11.5px; color: #2563eb; background: #eff6ff; padding: 2px 7px; border-radius: 6px; display: inline-block; margin-top: 3px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; color: #334155; }
.fb-cell { display: flex; align-items: center; gap: 8px; }
.fb-cell-ava { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; background: #e2e8f0; flex-shrink: 0; }

/* Spend Bars */
.spend-chart { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding: 12px 6px 24px; overflow-x: auto; border: 1px solid #eef2f8; border-radius: 12px; background: #fafcff; margin-bottom: 14px; }
.sp-col { flex: 1; min-width: 28px; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.sp-bar { width: 100%; max-width: 26px; background: linear-gradient(180deg, #3b82f6, #1d4ed8); border-radius: 6px 6px 2px 2px; min-height: 4px; transition: height 0.25s; }
.sp-val { font-size: 10px; color: #475569; font-weight: 700; }
.sp-date { font-size: 10px; color: #94a3b8; white-space: nowrap; }

/* Modal & Toast */
.modal-bg {
  position: fixed; inset: 0; background: rgba(15,23,42,0.45); backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 16px;
}
.modal-bg.open { display: flex; }
.modal-card {
  width: 100%; max-width: 460px; background: #fff; border-radius: 16px;
  box-shadow: 0 24px 60px rgba(15,23,42,0.2); overflow: hidden;
}
.modal-hd { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; font-weight: 800; font-size: 15px; }
.modal-bd { padding: 18px 20px; }
.modal-ft { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; background: #f8fafc; }
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 200;
  background: #0f172a; color: #fff; padding: 11px 18px; border-radius: 11px;
  font-size: 13px; font-weight: 600; box-shadow: 0 12px 30px rgba(15,23,42,0.28);
  opacity: 0; pointer-events: none; transform: translateY(10px); transition: all 0.2s;
}
.toast.show { opacity: 1; transform: translateY(0); }

.pager { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; font-size: 12.5px; color: #64748b; }
.empty-state { text-align: center; padding: 36px 20px; color: #64748b; }

@media (max-width: 960px) {
  .auth-split { grid-template-columns: 1fr; }
  .auth-showcase { display: none; }
  .kpi-grid-4, .kpi-grid-5 { grid-template-columns: repeat(2, 1fr); }
  .mid-grid { grid-template-columns: 1fr; }
}
