:root {
  color: #1d2038;
  background: #f4f3ee;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  font-synthesis: none;
  --ink: #1a1c35;
  --muted: #74778c;
  --paper: #f4f3ee;
  --white: #fff;
  --line: #dfded7;
  --violet: #7558ff;
  --violet-soft: #eeeaff;
  --cyan: #2db9c6;
  --lime: #b9e849;
  --navy: #171a38;
  --shadow: 0 24px 70px rgba(30, 31, 55, .09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100vh; }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  background:
    radial-gradient(circle at 20% 15%, rgba(117, 88, 255, .18), transparent 32%),
    radial-gradient(circle at 85% 80%, rgba(45, 185, 198, .16), transparent 30%),
    linear-gradient(135deg, #f6f4ed, #eef0f7);
}

.login-card {
  width: min(780px, 100%);
  padding: 44px;
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 32px;
  background: rgba(255,255,255,.88);
  box-shadow: 0 35px 100px rgba(38, 36, 78, .14);
  backdrop-filter: blur(18px);
}

.brand-lockup { display: flex; align-items: center; gap: 13px; }
.brand-lockup strong { display: block; font-size: 18px; letter-spacing: -.02em; }
.brand-lockup span { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .18em; }
.brand-mark { width: 42px; height: 42px; display: grid; place-content: center; gap: 3px; border-radius: 13px; background: var(--navy); transform: rotate(-3deg); }
.brand-mark i { display: block; width: 18px; height: 3px; border-radius: 4px; background: var(--lime); }
.brand-mark i:nth-child(2) { width: 12px; margin-left: 6px; background: #8ee9f0; }
.brand-mark i:nth-child(3) { width: 15px; margin-left: 2px; background: #9d89ff; }

.login-copy { margin: 72px 0 42px; max-width: 620px; }
.login-copy > span, .eyebrow, .panel-heading span { color: var(--violet); font-size: 11px; font-weight: 900; letter-spacing: .16em; text-transform: uppercase; }
.login-copy h1 { margin: 12px 0 16px; max-width: 590px; font-size: clamp(38px, 6vw, 62px); line-height: 1.06; letter-spacing: -.055em; }
.login-copy p { max-width: 560px; margin: 0; color: var(--muted); font-size: 16px; line-height: 1.8; }
#login-form label { display: block; margin-bottom: 9px; font-size: 12px; font-weight: 800; }
.password-row { display: flex; gap: 10px; }
.password-row input { flex: 1; min-width: 0; height: 54px; padding: 0 18px; border: 1px solid var(--line); border-radius: 14px; background: #fafafa; outline: none; }
.password-row input:focus { border-color: var(--violet); box-shadow: 0 0 0 4px rgba(117,88,255,.1); }
.password-row button { padding: 0 25px; border: 0; border-radius: 14px; color: white; background: var(--navy); font-weight: 800; }
.form-error { min-height: 20px; margin: 8px 0 0; color: #c44354; font-size: 12px; }
.login-card > footer { display: flex; align-items: center; gap: 8px; margin-top: 34px; padding-top: 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.status-dot, .live-dot { width: 8px; height: 8px; display: inline-block; border-radius: 50%; background: #79d153; box-shadow: 0 0 0 4px rgba(121,209,83,.14); }

.dashboard-view { min-height: 100vh; display: grid; grid-template-columns: 240px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 32px 24px; color: #fff; background: var(--navy); overflow: auto; }
.brand-lockup.inverse span { color: rgba(255,255,255,.52); }
.brand-lockup.inverse .brand-mark { background: white; }
.sidebar nav { display: grid; gap: 4px; margin-top: 66px; }
.sidebar nav a { display: grid; grid-template-columns: 28px 1fr; align-items: center; gap: 8px; padding: 13px 12px; border-radius: 11px; color: rgba(255,255,255,.58); text-decoration: none; font-size: 13px; font-weight: 700; transition: .2s ease; }
.sidebar nav a b { font-size: 9px; letter-spacing: .12em; }
.sidebar nav a:hover, .sidebar nav a.active { color: #fff; background: rgba(255,255,255,.08); }
.sidebar nav a.active b { color: var(--lime); }
.sidebar-note { margin-top: 70px; padding: 18px; border: 1px solid rgba(255,255,255,.12); border-radius: 15px; background: rgba(255,255,255,.04); }
.sidebar-note span { color: var(--lime); font-size: 10px; font-weight: 900; letter-spacing: .12em; }
.sidebar-note p { margin: 8px 0 0; color: rgba(255,255,255,.58); font-size: 11px; line-height: 1.65; }

.main-content { min-width: 0; padding: 45px 4.5vw 20px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.topbar h1 { margin: 8px 0 6px; font-size: clamp(30px, 4vw, 48px); line-height: 1; letter-spacing: -.045em; }
.topbar p { margin: 0; color: var(--muted); font-size: 12px; }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.secondary-button, .quiet-button { height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); color: var(--ink); font-size: 12px; font-weight: 800; }
.quiet-button { border-color: transparent; background: transparent; color: var(--muted); }
.secondary-button:hover { border-color: var(--violet); }

.range-bar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 42px 0 18px; }
.range-bar > div { display: flex; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: #ebeae5; }
.range-bar button { padding: 8px 13px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 800; }
.range-bar button.active { color: var(--ink); background: #fff; box-shadow: 0 5px 14px rgba(28,30,50,.08); }
.range-bar p { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--muted); font-size: 11px; }
.live-dot { width: 6px; height: 6px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric-card { min-height: 190px; display: flex; flex-direction: column; justify-content: space-between; padding: 23px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,.72); box-shadow: 0 15px 40px rgba(32,34,60,.035); }
.metric-card.hero-metric { color: #fff; border-color: var(--navy); background: var(--navy); box-shadow: 0 25px 60px rgba(23,26,56,.2); }
.metric-card div span { display: block; font-size: 13px; font-weight: 900; }
.metric-card div small { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; }
.metric-card.hero-metric div small { color: rgba(255,255,255,.48); }
.metric-card > strong { font-size: clamp(42px, 5vw, 62px); line-height: 1; letter-spacing: -.06em; }
.metric-card footer { padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.metric-card.hero-metric footer { color: rgba(255,255,255,.58); border-color: rgba(255,255,255,.13); }
.metric-card footer b { margin-right: 3px; color: var(--violet); }
.metric-card.hero-metric footer b { color: var(--lime); }

.panel { margin-top: 18px; padding: 28px; border: 1px solid var(--line); border-radius: 22px; background: rgba(255,255,255,.76); box-shadow: 0 15px 50px rgba(30,32,55,.035); scroll-margin-top: 20px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 28px; }
.panel-heading h2 { margin: 7px 0 0; font-size: 20px; letter-spacing: -.025em; }
.panel-heading p, .legend { margin: 0; color: var(--muted); font-size: 10px; }
.legend { display: flex; align-items: center; gap: 7px; }
.legend i { width: 8px; height: 8px; display: inline-block; margin-left: 7px; border-radius: 50%; }
.legend .violet { background: var(--violet); }.legend .cyan { background: var(--cyan); }.legend .lime { background: var(--lime); }

.trend-chart { min-height: 280px; position: relative; overflow: hidden; }
.trend-chart svg { display: block; width: 100%; height: 280px; overflow: visible; }
.trend-grid { stroke: #e7e6e0; stroke-width: 1; }
.trend-label { fill: #8a8c9c; font-size: 10px; }
.trend-line { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.trend-area { opacity: .08; }
.empty-message { min-height: 220px; display: grid; place-items: center; color: var(--muted); font-size: 13px; }

.funnel-list { display: grid; gap: 12px; }
.funnel-row { display: grid; grid-template-columns: 108px minmax(0, 1fr) 90px; align-items: center; gap: 14px; }
.funnel-row > span { font-size: 11px; font-weight: 800; }
.funnel-track { height: 32px; position: relative; overflow: hidden; border-radius: 8px; background: #eeede8; }
.funnel-track i { height: 100%; display: block; min-width: 0; border-radius: 8px; background: linear-gradient(90deg, var(--violet), #9b86ff); transition: width .5s ease; }
.funnel-row:nth-child(n+4) .funnel-track i { background: linear-gradient(90deg, #4fc4cd, var(--cyan)); }
.funnel-row:nth-last-child(-n+2) .funnel-track i { background: linear-gradient(90deg, #9bd52a, var(--lime)); }
.funnel-row strong { text-align: right; font-size: 12px; }
.funnel-row strong small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; font-weight: 600; }

.split-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 18px; }
.compact-panel { min-width: 0; }
.rank-list { display: grid; gap: 13px; }
.rank-row { display: grid; grid-template-columns: minmax(100px, 1fr) 2fr 54px; align-items: center; gap: 12px; }
.rank-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 800; }
.rank-track, .device-track { height: 7px; overflow: hidden; border-radius: 10px; background: #eae9e4; }
.rank-track i, .device-track i { display: block; height: 100%; border-radius: inherit; background: var(--violet); }
.rank-row b { text-align: right; font-size: 11px; }
.device-list { display: grid; gap: 14px; }
.device-row { display: grid; grid-template-columns: 50px 1fr 35px; align-items: center; gap: 10px; font-size: 11px; font-weight: 800; }
.device-track i { background: var(--cyan); }
.subsection-title { margin: 28px 0 10px; padding-top: 19px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: .12em; }
.browser-list { display: flex; flex-wrap: wrap; gap: 7px; }
.browser-list span { padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: white; font-size: 10px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th { padding: 0 10px 12px; color: var(--muted); font-size: 9px; letter-spacing: .09em; text-align: left; }
td { padding: 13px 10px; border-top: 1px solid #e9e8e3; font-size: 10px; vertical-align: top; }
.event-badge { display: inline-block; padding: 5px 8px; border-radius: 7px; color: #5b42cf; background: var(--violet-soft); font-weight: 800; }
.property-text { max-width: 340px; color: var(--muted); white-space: normal; line-height: 1.5; }

.page-footer { display: flex; justify-content: space-between; gap: 20px; padding: 34px 4px 16px; color: var(--muted); font-size: 10px; }
.page-footer strong { display: block; margin-bottom: 4px; color: var(--ink); }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 10; max-width: 360px; padding: 13px 17px; border-radius: 11px; color: white; background: var(--navy); box-shadow: var(--shadow); font-size: 12px; opacity: 0; transform: translateY(12px); pointer-events: none; transition: .25s ease; }
.toast.visible { opacity: 1; transform: translateY(0); }

@media (max-width: 1050px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-view { grid-template-columns: 200px minmax(0, 1fr); }
  .sidebar { padding: 28px 18px; }
  .split-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .login-view { padding: 16px; }
  .login-card { padding: 28px 22px; border-radius: 22px; }
  .login-copy { margin: 50px 0 30px; }
  .password-row { flex-direction: column; }
  .password-row button { height: 50px; }
  .dashboard-view { display: block; }
  .sidebar { position: relative; height: auto; padding: 19px 20px; }
  .sidebar nav, .sidebar-note { display: none; }
  .main-content { padding: 28px 15px 10px; }
  .topbar, .range-bar, .panel-heading { flex-direction: column; }
  .topbar-actions { justify-content: flex-start; }
  .range-bar { align-items: flex-start; margin-top: 28px; }
  .range-bar > div { max-width: 100%; overflow-x: auto; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .metric-card { min-height: 155px; padding: 18px; }
  .panel { padding: 20px 16px; border-radius: 17px; }
  .legend { flex-wrap: wrap; }
  .funnel-row { grid-template-columns: 82px minmax(0, 1fr) 55px; gap: 8px; }
  .page-footer { flex-direction: column; }
}

@media (max-width: 480px) {
  .metric-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 145px; }
}
