@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --brand: #25d366;
    --brand-dark: #128c4a;
    --brand-ink: #063a20;
    --ink: #152019;
    --muted: #68736c;
    --line: #dfe7e2;
    --canvas: #f4f8f5;
    --surface: #ffffff;
    --shadow: 0 18px 55px rgba(20, 44, 29, 0.07);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; color: var(--ink); background: var(--canvas); font-family: 'Plus Jakarta Sans', ui-sans-serif, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.brand { display: inline-flex; align-items: center; gap: 10px; color: #111814; font-size: 18px; font-weight: 800; letter-spacing: -0.04em; text-decoration: none; }
.brand strong { color: var(--brand-dark); font-weight: 700; }
.brand-centered { justify-content: center; }
.brand-mark { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 12px; color: var(--brand-dark); background: rgba(37, 211, 102, 0.13); }
.brand-mark svg { width: 20px; height: 20px; }
.eyebrow { color: var(--brand-dark); font-size: 10px; font-weight: 800; letter-spacing: 0.17em; text-transform: uppercase; }

/* Login */
.login-page { min-height: 100vh; background: radial-gradient(circle at 15% 20%, rgba(37, 211, 102, 0.12), transparent 28%), radial-gradient(circle at 88% 80%, rgba(18, 140, 74, 0.08), transparent 26%), #f6faf7; }
.login-page::before { position: fixed; inset: 0; pointer-events: none; content: ''; opacity: 0.35; background-image: linear-gradient(rgba(18, 140, 74, 0.04) 1px, transparent 1px), linear-gradient(90deg, rgba(18, 140, 74, 0.04) 1px, transparent 1px); background-size: 40px 40px; mask-image: linear-gradient(to bottom, black, transparent 78%); }
.login-shell { position: relative; z-index: 1; display: grid; min-height: 100vh; place-items: center; padding: 28px 18px; }
.login-card { width: min(100%, 470px); padding: 42px; border: 1px solid rgba(205, 220, 210, 0.9); border-radius: 30px; background: rgba(255, 255, 255, 0.92); box-shadow: 0 30px 90px rgba(14, 54, 30, 0.12); backdrop-filter: blur(16px); }
.login-heading { margin-top: 52px; text-align: center; }
.login-heading h1 { margin: 12px 0 0; font-size: clamp(32px, 7vw, 45px); line-height: 1.05; letter-spacing: -0.055em; }
.login-heading p { margin: 16px auto 0; max-width: 340px; color: var(--muted); font-size: 14px; line-height: 1.7; }
.login-form { margin-top: 32px; }
.login-form label { display: block; margin-bottom: 9px; font-size: 11px; font-weight: 800; }
.code-field { position: relative; }
.code-field svg { position: absolute; top: 50%; left: 16px; width: 18px; color: #829087; transform: translateY(-50%); }
.code-field input { width: 100%; height: 54px; padding: 0 16px 0 46px; border: 1px solid #dce6df; border-radius: 14px; outline: none; color: var(--ink); background: #f9fbfa; transition: 180ms ease; }
.code-field input:focus { border-color: var(--brand); background: white; box-shadow: 0 0 0 4px rgba(37, 211, 102, 0.12); }
.login-form button { display: flex; width: 100%; height: 54px; align-items: center; justify-content: center; gap: 10px; margin-top: 14px; border: 0; border-radius: 14px; color: var(--brand-ink); background: var(--brand); box-shadow: 0 12px 28px rgba(37, 211, 102, 0.24); font-size: 13px; font-weight: 800; transition: 180ms ease; }
.login-form button:hover { transform: translateY(-1px); background: #20c65c; }
.login-owner { margin: 25px 0 0; color: #93a098; font-size: 10px; text-align: center; }
.alert { margin-top: 24px; padding: 12px 14px; border: 1px solid #fecaca; border-radius: 12px; color: #b42318; background: #fff5f5; font-size: 12px; line-height: 1.5; }

/* DataFast-inspired WaSubs dashboard */
.dashboard-page { min-height: 100vh; background: #f5f8f6; }
.topbar { position: sticky; z-index: 30; top: 0; display: flex; height: 68px; align-items: center; justify-content: space-between; padding: 0 max(24px, calc((100vw - 1380px) / 2)); border-bottom: 1px solid rgba(220, 230, 223, 0.9); background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(18px); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.live-pill { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: white; font-size: 10px; }
.live-pill span { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px rgba(37, 211, 102, 0.12); }
.live-pill strong { color: var(--ink); }
.logout-button { display: grid; width: 36px; height: 36px; place-items: center; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); background: white; }
.logout-button:hover { color: var(--brand-dark); border-color: #bfd0c4; }
.logout-button svg { width: 16px; }

.dashboard-shell { width: min(100% - 36px, 1380px); margin: 0 auto; padding: 40px 0 72px; }
.dashboard-intro { display: flex; align-items: center; justify-content: space-between; gap: 28px; }
.dashboard-intro h1 { margin: 8px 0 0; font-size: clamp(28px, 4vw, 42px); line-height: 1; letter-spacing: -0.055em; }
.dashboard-intro p { margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.range-tabs { display: inline-flex; gap: 4px; padding: 5px; border: 1px solid var(--line); border-radius: 13px; background: white; box-shadow: 0 7px 22px rgba(20, 44, 29, 0.04); }
.range-tabs button { min-height: 34px; padding: 0 13px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; font-size: 9px; font-weight: 700; white-space: nowrap; }
.range-tabs button:hover { color: var(--ink); background: var(--canvas); }
.range-tabs button.active { color: var(--brand-ink); background: rgba(37, 211, 102, 0.16); }

.panel { padding: 24px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.traffic-workspace { margin-top: 26px; padding: 0 26px 24px; }
.metric-strip { display: grid; grid-template-columns: repeat(6, 1fr); border-bottom: 1px solid var(--line); }
.metric-item { min-width: 0; padding: 22px; border-right: 1px solid var(--line); }
.metric-item:first-child { padding-left: 0; }
.metric-item:last-child { border-right: 0; }
.metric-item > span { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; font-weight: 700; white-space: nowrap; }
.metric-item > span i { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px rgba(37, 211, 102, 0.10); }
.metric-item strong { display: block; margin-top: 10px; font-size: 26px; line-height: 1; letter-spacing: -0.045em; }
.metric-item small { display: block; overflow: hidden; margin-top: 8px; color: #9aa59e; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.metric-live strong { color: var(--brand-dark); }

.chart-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding-top: 22px; }
.chart-heading h2, .panel-heading h2 { margin: 6px 0 0; font-size: 16px; letter-spacing: -0.03em; }
.chart-legend { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 9px; }
.views-dot, .visitors-dot { width: 7px; height: 7px; border-radius: 50%; }
.views-dot { background: var(--brand); }
.visitors-dot { margin-left: 8px; background: #b6c5bc; }
.chart-wrap { position: relative; min-height: 335px; margin-top: 14px; }
.traffic-chart { display: block; width: 100%; height: 290px; overflow: visible; }
.chart-labels { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; color: #98a39c; font-size: 9px; }
.empty-state { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 12px; }

.analytics-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px; margin-top: 14px; }
.acquisition-panel, .audience-panel { grid-column: span 6; min-height: 330px; }
.pages-panel { grid-column: span 7; min-height: 275px; }
.globe-panel { grid-column: span 5; min-height: 275px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.panel-number { color: #aab5ae; font-size: 10px; font-weight: 800; letter-spacing: 0.08em; }
.tabbed-heading { align-items: flex-end; }
.panel-tabs { display: inline-flex; gap: 3px; padding: 4px; border: 1px solid var(--line); border-radius: 11px; background: #f7faf8; }
.panel-tabs button { min-height: 28px; padding: 0 11px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-size: 9px; font-weight: 700; }
.panel-tabs button:hover { color: var(--ink); }
.panel-tabs button.active { color: var(--brand-ink); background: white; box-shadow: 0 2px 8px rgba(20, 44, 29, 0.08), inset 0 0 0 1px rgba(18, 140, 74, 0.14); }

.rank-list { display: grid; gap: 8px; margin-top: 24px; }
.rank-row { display: grid; min-height: 38px; grid-template-columns: minmax(100px, 1fr) 2fr auto; align-items: center; gap: 14px; padding: 0 10px; border-radius: 9px; background: #f8faf9; }
.rank-label { overflow: hidden; font-size: 10px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.rank-track { height: 7px; overflow: hidden; border-radius: 99px; background: #e8efea; }
.rank-fill { display: block; height: 100%; min-width: 4px; border-radius: inherit; background: linear-gradient(90deg, var(--brand-dark), var(--brand)); }
.rank-value { min-width: 24px; color: var(--muted); font-size: 9px; font-weight: 700; text-align: right; }

.country-list { display: grid; gap: 8px; margin-top: 24px; }
.country-row { position: relative; display: grid; min-height: 38px; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 10px; overflow: hidden; padding: 0 11px; border-radius: 9px; background: #f8faf9; }
.country-bar { position: absolute; z-index: 0; inset: 0 auto 0 0; border-radius: inherit; background: linear-gradient(90deg, rgba(18, 140, 74, 0.18), rgba(37, 211, 102, 0.06)); }
.country-code, .country-name, .country-views { position: relative; z-index: 1; }
.country-code { display: grid; width: 28px; height: 24px; place-items: center; border-radius: 7px; color: var(--brand-dark); background: rgba(255, 255, 255, 0.75); font-size: 8px; font-weight: 800; }
.country-name { overflow: hidden; font-size: 10px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.country-views { color: var(--muted); font-size: 9px; font-weight: 700; }

.device-content { display: flex; align-items: center; gap: 30px; margin-top: 26px; }
.donut { display: grid; flex: 0 0 130px; width: 130px; height: 130px; place-content: center; border-radius: 50%; background: conic-gradient(var(--brand) 0 0, #edf2ef 0); box-shadow: inset 0 0 0 28px white; text-align: center; }
.donut span { font-size: 24px; font-weight: 800; letter-spacing: -0.04em; }
.donut small { color: var(--muted); font-size: 8px; }
.device-legend { display: grid; flex: 1; gap: 13px; }
.legend-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 10px; }
.legend-label { display: flex; align-items: center; gap: 7px; font-weight: 700; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; }
.legend-value { color: var(--muted); }

.page-list { display: grid; gap: 0; margin-top: 18px; }
.page-row { display: grid; min-height: 52px; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 12px; border-bottom: 1px solid #edf1ee; }
.page-row:last-child { border-bottom: 0; }
.page-rank { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 9px; color: var(--brand-dark); background: rgba(37, 211, 102, 0.11); font-size: 10px; font-weight: 800; }
.page-path { overflow: hidden; font-size: 10px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.page-views { color: var(--muted); font-size: 9px; }

.globe-panel { position: relative; overflow: hidden; color: white; border-color: #173d27; background: linear-gradient(135deg, #173d27, #102d1c); }
.globe-copy { position: relative; z-index: 2; max-width: 230px; }
.globe-panel .eyebrow { color: var(--brand); }
.globe-panel h2 { margin: 10px 0 0; font-size: 26px; line-height: 1.1; letter-spacing: -0.045em; }
.globe-panel p { margin: 14px 0 0; color: rgba(255, 255, 255, 0.58); font-size: 10px; line-height: 1.7; }
.globe-stats { display: flex; gap: 24px; margin-top: 28px; }
.globe-stats strong, .globe-stats span { display: block; }
.globe-stats strong { font-size: 21px; }
.globe-stats span { margin-top: 4px; color: rgba(255, 255, 255, 0.48); font-size: 8px; }
.globe { position: absolute; right: -35px; bottom: -75px; width: 270px; height: 270px; overflow: hidden; border: 1px solid rgba(37, 211, 102, 0.28); border-radius: 50%; background: radial-gradient(circle at 36% 34%, rgba(37, 211, 102, 0.23), rgba(37, 211, 102, 0.03) 60%, transparent 61%); }
.globe::before, .globe::after, .globe-line { position: absolute; inset: 18%; border: 1px solid rgba(37, 211, 102, 0.2); border-radius: 50%; content: ''; }
.globe::after { inset: 0 35%; }
.globe-line-one { inset: 35% 0; }.globe-line-two { inset: 10% 28%; transform: rotate(35deg); }.globe-line-three { inset: 10% 28%; transform: rotate(-35deg); }
.globe-dot { position: absolute; z-index: 2; width: 7px; height: 7px; border: 2px solid #102d1c; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px rgba(37, 211, 102, 0.12); }
.dot-one { top: 28%; left: 32%; }.dot-two { top: 47%; left: 62%; }.dot-three { top: 68%; left: 41%; }

.empty-list { padding: 25px 0; color: #99a49d; font-size: 10px; text-align: center; }
.loading-overlay { position: fixed; z-index: 50; right: 20px; bottom: 20px; display: flex; align-items: center; gap: 9px; padding: 11px 15px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); background: white; box-shadow: var(--shadow); font-size: 10px; }
.loading-overlay span { width: 9px; height: 9px; border: 2px solid #cfe1d5; border-top-color: var(--brand-dark); border-radius: 50%; animation: spin 700ms linear infinite; }
.toast { position: fixed; z-index: 50; right: 20px; bottom: 20px; max-width: 300px; padding: 12px 15px; border-radius: 12px; color: #8f1d1d; background: #fff0f0; box-shadow: var(--shadow); font-size: 11px; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1000px) {
    .dashboard-intro { align-items: flex-start; flex-direction: column; }
    .range-tabs { width: 100%; overflow-x: auto; }
    .range-tabs button { flex: 1 0 auto; }
    .metric-strip { grid-template-columns: repeat(3, 1fr); }
    .metric-item:nth-child(3) { border-right: 0; }
    .metric-item:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
    .metric-item:nth-child(4) { padding-left: 0; }
    .acquisition-panel, .audience-panel, .pages-panel, .globe-panel { grid-column: span 12; }
}

@media (max-width: 640px) {
    .login-card { padding: 32px 22px; border-radius: 24px; }
    .login-heading { margin-top: 42px; }
    .topbar { height: 62px; padding: 0 16px; }
    .topbar .brand { font-size: 15px; }
    .topbar .brand-mark { width: 32px; height: 32px; }
    .live-pill { display: none; }
    .dashboard-shell { width: min(100% - 24px, 1380px); padding: 30px 0 60px; }
    .dashboard-intro h1 { font-size: 32px; }
    .traffic-workspace { padding: 0 16px 16px; }
    .metric-strip { grid-template-columns: repeat(2, 1fr); }
    .metric-item { padding: 17px 14px; border-bottom: 1px solid var(--line); }
    .metric-item:nth-child(odd) { padding-left: 0; border-right: 1px solid var(--line); }
    .metric-item:nth-child(even) { border-right: 0; }
    .metric-item:nth-child(n+5) { border-bottom: 0; }
    .metric-item strong { font-size: 23px; }
    .chart-heading { align-items: flex-start; flex-direction: column; }
    .chart-wrap { min-height: 260px; }
    .traffic-chart { height: 220px; }
    .chart-labels span:nth-child(even) { display: none; }
    .analytics-grid { display: block; }
    .analytics-grid .panel { margin-top: 12px; }
    .tabbed-heading { align-items: flex-start; flex-direction: column; }
    .panel-tabs { width: 100%; }
    .panel-tabs button { flex: 1; }
    .rank-row { grid-template-columns: minmax(82px, 1fr) 1.4fr auto; gap: 8px; }
    .device-content { gap: 22px; }
    .donut { flex-basis: 112px; width: 112px; height: 112px; box-shadow: inset 0 0 0 24px white; }
    .globe-panel { min-height: 325px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation-duration: 0.01ms !important; }
}

