:root {
    --bg: #0d1117;
    --bg-elev: #161b22;
    --bg-elev2: #1c2330;
    --border: #2a3343;
    --text: #e6edf3;
    --muted: #8b98a9;
    --accent: #4f8cff;
    --accent-2: #7c5cff;
    --good: #3fb950;
    --radius: 14px;
    --shadow: 0 8px 30px rgba(0, 0, 0, .35);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: radial-gradient(1200px 600px at 80% -10%, #182135 0%, var(--bg) 55%);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }

/* ---- Topbar ---- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(6px);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.brand-mark {
    font-size: 22px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.user-menu { display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border); }
.user-name { font-size: 14px; color: var(--muted); }

/* ---- Buttons ---- */
.btn {
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 9px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: .15s ease;
    color: var(--text);
    background: var(--bg-elev2);
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border: none; }
.btn-ghost { background: transparent; border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-elev2); }
.btn-google { background: #fff; color: #1a1a1a; display: inline-flex; align-items: center; gap: 10px; text-decoration: none; padding: 12px 22px; font-size: 15px; }
.g-icon { font-weight: 800; color: #4285f4; }

/* ---- Landing ---- */
.landing { flex: 1; display: grid; place-items: center; padding: 40px 20px; }
.landing-inner { max-width: 560px; text-align: center; }
.landing-inner h1 { font-size: clamp(28px, 5vw, 44px); line-height: 1.1; margin: 0 0 16px; }
.landing-inner p { color: var(--muted); font-size: 17px; line-height: 1.6; margin: 0 0 28px; }
.auth-note { margin-top: 18px; color: #ff7b72; font-size: 14px; }

/* ---- App ---- */
.app { flex: 1; padding: 24px; max-width: 1200px; margin: 0 auto; width: 100%; }
.toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }
.toolbar-actions { display: flex; gap: 10px; }
.range { display: inline-flex; flex-wrap: wrap; gap: 4px; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 10px; padding: 4px; }
.range button { background: transparent; border: none; color: var(--muted); padding: 7px 13px; cursor: pointer; font-weight: 600; font-size: 14px; border-radius: 7px; }
.range button:hover { color: var(--text); }
.range button.active { background: var(--bg-elev2); color: var(--text); }

/* ---- Summary cards ---- */
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 22px; }
.sumcard { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.sumcard .label { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.sumcard .value { font-size: 30px; font-weight: 700; margin-top: 6px; }

/* ---- Property grid ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.card {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
    position: relative;
}
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.card-title { font-weight: 700; font-size: 16px; }
.card-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.card-remove { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; }
.card-remove:hover { color: #ff7b72; }
.metrics { display: flex; gap: 18px; margin-top: 16px; }
.metric .m-value { font-size: 22px; font-weight: 700; }
.metric .m-label { font-size: 12px; color: var(--muted); }
.spark { margin-top: 16px; height: 44px; width: 100%; }
.card-error { margin-top: 14px; color: #ff7b72; font-size: 13px; }

/* ---- Empty ---- */
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty p { margin-bottom: 16px; font-size: 18px; }

/* ---- Modal ---- */
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal-card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); width: min(520px, 100%); max-height: 80vh; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-body { padding: 12px 20px; overflow-y: auto; }
.modal-foot { padding: 16px 20px; border-top: 1px solid var(--border); text-align: right; }
.pick { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 10px; cursor: pointer; }
.pick:hover { background: var(--bg-elev2); }
.pick input { width: 18px; height: 18px; accent-color: var(--accent); }
.pick .p-name { font-weight: 600; }
.pick .p-sub { color: var(--muted); font-size: 12px; }
.pick.added { opacity: .5; cursor: default; }

/* ---- Footer ---- */
.footer { text-align: center; padding: 20px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--border); }
.footer a { color: var(--accent); text-decoration: none; }

/* ---- Loading skeleton ---- */
.skeleton { background: linear-gradient(90deg, var(--bg-elev) 25%, var(--bg-elev2) 37%, var(--bg-elev) 63%); background-size: 400% 100%; animation: shimmer 1.4s infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
