@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Fraunces:opsz,wght@9..144,400;9..144,600;9..144,700&display=swap');

:root {
    --bg:         #f5f1ea;
    --bg-soft:    #ede7dc;
    --surface:    #fffdf9;
    --surface-2:  #f9f5ee;
    --border:     #e5dccd;
    --border-soft:#efe9dc;
    --text:       #1c1a17;
    --text-2:     #4a443c;
    --muted:      #8a8278;
    --accent:     #2a4a3e;       /* deep evergreen */
    --accent-2:   #355d4d;
    --accent-soft:#dce8e2;
    --gold:       #9e7b3a;
    --gold-soft:  #f1e4c8;
    --danger:     #b53d3d;
    --success:    #2a6b59;
    --shadow-sm:  0 1px 2px rgba(28, 26, 23, 0.04), 0 1px 1px rgba(28, 26, 23, 0.03);
    --shadow:     0 4px 16px rgba(28, 26, 23, 0.05), 0 1px 2px rgba(28, 26, 23, 0.04);
    --shadow-lg:  0 12px 40px rgba(28, 26, 23, 0.08), 0 2px 6px rgba(28, 26, 23, 0.04);
    --radius:     12px;
    --radius-sm:  8px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--bg);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === Navbar === */
header {
    background: rgba(255, 253, 249, 0.85);
    backdrop-filter: saturate(180%) blur(8px);
    -webkit-backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid var(--border-soft);
    position: sticky;
    top: 0;
    z-index: 50;
}
.nav {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 14px 32px;
    max-width: 1440px;
    margin: 0 auto;
}
.nav .brand {
    font-family: 'Fraunces', serif;
    font-weight: 700;
    font-size: 18px;
    color: var(--text);
    text-decoration: none;
    margin-right: 28px;
    letter-spacing: -0.01em;
}
.nav .brand:hover { color: var(--accent); }
.nav > a:not(.brand) {
    color: var(--text-2);
    text-decoration: none;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.12s ease;
}
.nav > a:not(.brand):hover { background: var(--bg-soft); color: var(--text); }
.nav .spacer { flex: 1; }
.sync-form { margin: 0; }
.sync-form button {
    background: var(--surface);
    color: var(--text-2);
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    transition: all 0.12s ease;
}
.sync-form button:hover { background: var(--accent); color: var(--surface); border-color: var(--accent); }
.sync-form button:disabled { opacity: 0.5; cursor: wait; }
.sync-info { color: var(--muted); font-size: 11px; margin-left: 6px; }
.sync-info.warn { color: var(--danger); }
.logout-btn { background: transparent !important; }
.logout-btn:hover { background: var(--danger) !important; color: #fff !important; border-color: var(--danger) !important; }

main {
    max-width: 1440px;
    margin: 0 auto;
    padding: 36px 32px 80px;
}

/* === Typography === */
h1 {
    font-family: 'Fraunces', serif;
    font-weight: 600;
    font-size: 36px;
    letter-spacing: -0.02em;
    margin: 0 0 4px 0;
    color: var(--text);
}
h1 + .page-sub { color: var(--muted); margin: 0 0 32px 0; font-size: 14px; }
h2 {
    margin-top: 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 18px;
}
h3 { font-size: 15px; font-weight: 600; margin: 0; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono-num { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }

/* === Cards === */
.card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.15s ease;
}
.card:hover { box-shadow: var(--shadow); }
.card-flat { box-shadow: none; }

.grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4col { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 1000px) {
    .grid-2col, .grid-3col, .grid-4col { grid-template-columns: 1fr; }
    main { padding: 24px 18px; }
    h1 { font-size: 28px; }
}

/* === Hero block (main page) === */
.hero {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 24px;
    margin-bottom: 28px;
}
@media (max-width: 1000px) { .hero { grid-template-columns: 1fr; } }
.hero-wheel {
    background: linear-gradient(160deg, var(--surface) 0%, var(--surface-2) 100%);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
}
.hero-wheel canvas { max-height: 360px; }

.hero-kpis { display: flex; flex-direction: column; gap: 16px; }
.kpi {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 20px 22px;
    box-shadow: var(--shadow-sm);
    position: relative;
}
.kpi-label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
}
.kpi-value {
    font-family: 'Fraunces', serif;
    font-weight: 600;
    font-size: 32px;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.kpi-sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.kpi-accent .kpi-value { color: var(--accent); }
.kpi-gold .kpi-value { color: var(--gold); }

.big-number {
    font-family: 'Fraunces', serif;
    font-weight: 600;
    font-size: 32px;
    letter-spacing: -0.02em;
    margin: 4px 0;
    font-variant-numeric: tabular-nums;
}

/* === Progress bar === */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-soft);
    border-radius: 999px;
    overflow: hidden;
    margin: 10px 0;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent) 0%, var(--gold) 100%);
    border-radius: 999px;
    transition: width 0.4s ease;
}

/* === Sphere chips with icons === */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    margin-right: 4px;
    line-height: 1.4;
}
.chip-icon { font-size: 12px; }
.chip-health     { background: #fbe5e3; color: #8c2520; }
.chip-family     { background: #f8e0ed; color: #7a1c5c; }
.chip-finance    { background: #d8ebe1; color: #1b5b3c; }
.chip-work       { background: #d9e6f1; color: #14506a; }
.chip-learning   { background: #f5e7c2; color: #6e5009; }
.chip-spirit     { background: #e6dbef; color: #432872; }
.chip-joy        { background: #f7e1cc; color: #844214; }
.chip-social     { background: #e6dbcf; color: #432d20; }

/* === Focus goals (premium card) === */
.focus-card {
    background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
    border: 1px solid var(--border-soft);
    border-left: 3px solid var(--accent);
    padding: 14px 18px;
    margin: 10px 0;
    border-radius: var(--radius-sm);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.focus-card:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.focus-title { font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.focus-why {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-soft);
    font-style: italic;
    color: var(--text-2);
}
.focus-meta { display: flex; gap: 8px; align-items: center; margin-top: 4px; flex-wrap: wrap; }

/* === Quick links === */
.quick-links { list-style: none; padding: 0; margin: 0; }
.quick-links li {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    transition: background 0.12s ease;
}
.quick-links li:hover { background: var(--bg-soft); }
.quick-links a { color: var(--text); text-decoration: none; display: block; font-size: 13px; }

/* === Tables === */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid var(--border-soft);
    font-size: 13px;
}
.table th {
    font-weight: 600;
    color: var(--muted);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom-color: var(--border);
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--bg-soft); }
.table a { color: var(--text); text-decoration: none; border-bottom: 1px solid transparent; }
.table a:hover { border-bottom-color: var(--accent); color: var(--accent); }

/* === Horizons (goals page) === */
.horizon-col {
    background: var(--surface-2);
    padding: 16px;
    border-radius: var(--radius);
    min-height: 200px;
    border: 1px solid var(--border-soft);
}
.horizon-header {
    margin: 0 0 12px 0;
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
}
.goal-card {
    background: var(--surface);
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-sm);
}
.goal-title { font-weight: 500; margin-top: 6px; font-size: 14px; }

/* === Project cards === */
.project-card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: transform 0.12s ease, box-shadow 0.15s ease;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.project-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.project-name { font-weight: 600; font-size: 15px; margin-bottom: 4px; color: var(--text); }
.btn-link {
    display: inline-block;
    margin-top: 10px;
    padding: 6px 12px;
    background: var(--accent-soft);
    color: var(--accent);
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    align-self: flex-start;
    transition: all 0.12s ease;
}
.btn-link:hover { background: var(--accent); color: var(--surface); }

/* === Sphere mini-cards (wheel page footer) === */
.sphere-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-top: 8px;
}
.sphere-mini {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    text-align: center;
}
.sphere-mini-icon { font-size: 28px; margin-bottom: 4px; }
.sphere-mini-name { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.sphere-mini-score {
    font-family: 'Fraunces', serif;
    font-size: 28px;
    font-weight: 600;
    margin-top: 2px;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.sphere-mini-empty { color: var(--muted); }

/* === Empty states === */
.empty {
    text-align: center;
    padding: 36px 20px;
    color: var(--muted);
}
.empty-icon { font-size: 36px; margin-bottom: 10px; opacity: 0.6; }
.empty-msg { font-size: 14px; margin-bottom: 14px; }
.empty .btn-link { background: var(--accent); color: var(--surface); }
.empty .btn-link:hover { background: var(--accent-2); }

/* === Login === */
.login-body {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; background: var(--bg); padding: 16px;
    background-image:
        radial-gradient(at 20% 10%, rgba(42, 74, 62, 0.06) 0%, transparent 50%),
        radial-gradient(at 80% 90%, rgba(158, 123, 58, 0.06) 0%, transparent 50%);
}
.login-card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 40px 36px;
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow-lg);
}
.login-title { margin: 0; font-family: 'Fraunces', serif; font-size: 22px; }
.login-sub { margin: 6px 0 24px 0; }
.login-error {
    background: #fde2e0;
    color: #8c2520;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 18px;
}
.login-card form { display: flex; flex-direction: column; gap: 16px; }
.login-card label {
    display: flex; flex-direction: column; gap: 6px;
    font-size: 11px; color: var(--muted);
    font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
}
.login-card input {
    padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: 14px; font-family: inherit; background: var(--surface-2);
    color: var(--text);
    transition: all 0.15s ease;
}
.login-card input:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px rgba(42, 74, 62, 0.12); }
.login-card button {
    padding: 12px 16px; background: var(--accent); color: var(--surface);
    border: none; border-radius: var(--radius-sm); cursor: pointer; font-size: 14px;
    font-weight: 600; margin-top: 8px; font-family: inherit;
    transition: all 0.15s ease;
}
.login-card button:hover { background: var(--accent-2); transform: translateY(-1px); }
