/* ===========================================================================
   «Мой путь» — тёмная тема в духе timekeeping.click
   =========================================================================== */

:root {
    /* Светлая тема в духе lex-go.ru */
    --bg: #ffffff;
    --bg-elev: #f4f6fb;
    --bg-card: #ffffff;
    --bg-card-2: #f4f6fb;
    --border: #e3e7f0;
    --text: #1a2b4a;         /* тёмно-синий — основной текст и заголовки */
    --text-dim: #4a5878;
    --text-mute: #8a94ad;

    --accent: #d6244a;       /* малиново-красный — фирменный акцент */
    --accent-2: #1f6feb;     /* синий — второй акцент (время) */
    --accent-soft: rgba(214, 36, 74, .10);
    --income: #16a34a;
    --expense: #d6244a;
    --warn: #d97706;

    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 10px 30px rgba(26, 43, 74, .08);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background:
        radial-gradient(1100px 500px at 75% -10%, rgba(31, 111, 235, .10), transparent 60%),
        radial-gradient(900px 460px at 0% 0%, rgba(214, 36, 74, .06), transparent 55%),
        var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0 0 .4em; font-weight: 700; letter-spacing: -.02em; }
h1 { font-size: 2rem; }
p { margin: 0 0 1em; color: var(--text-dim); }

/* ---------- Topbar ---------- */
.topbar {
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; gap: 24px;
    padding: 14px 24px;
    background: rgba(255, 255, 255, .85);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 1.05rem; }
.brand-mark { font-size: 1.3rem; }
.brand-text { background: linear-gradient(90deg, var(--text), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.topnav { display: flex; gap: 4px; }
.topnav a {
    padding: 8px 14px; border-radius: 10px; color: var(--text-dim);
    font-weight: 500; transition: .15s;
}
.topnav a:hover { color: var(--text); background: var(--bg-card); }
.topnav a.active { color: var(--accent); background: var(--accent-soft); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user-chip {
    padding: 6px 12px; border-radius: 999px; background: var(--bg-card);
    border: 1px solid var(--border); font-size: .85rem; font-weight: 600;
}

/* ---------- Buttons ---------- */
.btn, .btn-ghost {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 20px; border-radius: 12px; border: none; cursor: pointer;
    font: inherit; font-weight: 600; transition: .15s; text-align: center;
}
.btn { background: linear-gradient(135deg, var(--accent), #b01a3c); color: #fff; box-shadow: 0 6px 18px rgba(214, 36, 74, .28); }
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(214, 36, 74, .36); }
.btn-ghost { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-card-2); }
.btn-sm { padding: 7px 14px; font-size: .85rem; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-danger { background: rgba(214, 36, 74, .10); color: var(--expense); border: 1px solid rgba(214, 36, 74, .3); }
.btn-accent2 { background: linear-gradient(135deg, var(--accent-2), #1554c9); box-shadow: 0 6px 18px rgba(31, 111, 235, .3); color: #fff; }

/* ---------- Layout ---------- */
.page { max-width: 1100px; margin: 0 auto; padding: 28px 24px 80px; }
.page-wide { max-width: 1280px; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 860px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } .topnav { display: none; } }

.card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
}
.card-pad-lg { padding: 28px; }
.card h2 { font-size: 1.1rem; }
.card-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title h2 { margin: 0; }

.muted { color: var(--text-mute); }
.dim { color: var(--text-dim); }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 18px; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .72rem; color: var(--accent); font-weight: 700; }

/* ---------- Stat cards ---------- */
.stat { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.stat .label { color: var(--text-mute); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; }
.stat .value { font-size: 1.8rem; font-weight: 800; margin-top: 6px; letter-spacing: -.02em; }
.stat .value.pos { color: var(--income); }
.stat .value.neg { color: var(--expense); }

/* ---------- Timer (Quick Timer) ---------- */
.timer-wrap { text-align: center; padding: 36px 24px; }
.timer-display {
    font-variant-numeric: tabular-nums; font-weight: 800;
    font-size: clamp(3rem, 12vw, 6rem); letter-spacing: .02em; line-height: 1;
    background: linear-gradient(180deg, var(--text), var(--text-dim));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.timer-display.running { background: linear-gradient(180deg, var(--accent-2), #1554c9); -webkit-background-clip: text; background-clip: text; color: transparent; }
.timer-hint { color: var(--text-mute); margin: 14px 0 22px; }
.timer-controls { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.timer-big-btn { padding: 16px 48px; font-size: 1.1rem; border-radius: 16px; }
.timer-meta { display: flex; gap: 10px; justify-content: center; margin: 18px auto 0; max-width: 520px; flex-wrap: wrap; }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .8rem; color: var(--text-dim); margin-bottom: 6px; font-weight: 600; }
input, select, textarea {
    width: 100%; padding: 11px 13px; border-radius: var(--radius-sm);
    background: var(--bg-elev); border: 1px solid var(--border); color: var(--text);
    font: inherit; transition: .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 70px; }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field-row > * { flex: 1; min-width: 120px; }
.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.checkbox-row { display: flex; align-items: flex-start; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 12px; background: var(--bg-elev); }
.checkbox-row input { width: auto; margin-top: 3px; }
.checkbox-row .meta { flex: 1; }
.checkbox-row .meta b { display: block; }

/* ---------- Lists / entries ---------- */
.entry-day { margin-bottom: 26px; }
.entry-day-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.entry-day-head .date { font-weight: 700; }
.entry-day-head .total { color: var(--accent-2); font-weight: 700; font-variant-numeric: tabular-nums; }

.row-item {
    display: flex; align-items: center; gap: 14px; padding: 13px 16px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-sm); margin-bottom: 8px; transition: .15s;
}
.row-item:hover { border-color: var(--accent); }
.row-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.row-icon { font-size: 1.3rem; flex: none; width: 34px; text-align: center; }
.row-main { flex: 1; min-width: 0; }
.row-main .title { font-weight: 600; }
.row-main .sub { font-size: .82rem; color: var(--text-mute); }
.row-time { color: var(--text-dim); font-variant-numeric: tabular-nums; font-size: .85rem; }
.row-amount { font-weight: 700; font-variant-numeric: tabular-nums; }
.row-amount.income { color: var(--income); }
.row-amount.expense { color: var(--expense); }
.row-actions form { display: inline; }
.icon-btn { background: none; border: none; color: var(--text-mute); cursor: pointer; padding: 6px; border-radius: 8px; font-size: 1rem; }
.icon-btn:hover { color: var(--expense); background: rgba(255, 107, 107, .1); }

/* ---------- Badges / chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--bg-card-2); border: 1px solid var(--border); }
.tag { display: inline-block; padding: 2px 9px; border-radius: 8px; font-size: .72rem; font-weight: 600; }

/* ---------- Donut ---------- */
.donut-wrap { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; }
.donut { width: 200px; height: 200px; flex: none; }
.legend { flex: 1; min-width: 240px; }
.legend-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.legend-item:last-child { border-bottom: none; }
.legend-dot { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.legend-name { flex: 1; }
.legend-val { font-variant-numeric: tabular-nums; font-weight: 700; }
.legend-pct { color: var(--text-mute); width: 52px; text-align: right; font-variant-numeric: tabular-nums; }

/* progress bar */
.progress { height: 8px; border-radius: 999px; background: var(--bg-elev); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

/* period tabs */
.tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--bg-elev); border-radius: 12px; border: 1px solid var(--border); }
.tabs a { padding: 7px 14px; border-radius: 9px; color: var(--text-dim); font-size: .85rem; font-weight: 600; }
.tabs a.active { background: var(--accent); color: #fff; }

/* ---------- Flash ---------- */
.flash { max-width: 1100px; margin: 14px auto 0; padding: 12px 18px; border-radius: 12px; font-weight: 500; }
.flash-success { background: rgba(22, 163, 74, .10); border: 1px solid rgba(22, 163, 74, .3); color: var(--income); }
.flash-error { background: rgba(214, 36, 74, .10); border: 1px solid rgba(214, 36, 74, .3); color: var(--expense); }

/* ---------- Hero (landing) ---------- */
.hero { padding: 70px 24px 50px; text-align: center; max-width: 880px; margin: 0 auto; }
.hero h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); line-height: 1.05; margin-bottom: 18px; }
.hero h1 .grad { background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .lead { font-size: 1.2rem; max-width: 620px; margin: 0 auto 30px; }
.hero-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 56px 0; }
@media (max-width: 860px) { .features { grid-template-columns: 1fr 1fr; } }
@media (max-width: 540px) { .features { grid-template-columns: 1fr; } }
.feature { padding: 22px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); }
.feature .ico { font-size: 1.8rem; margin-bottom: 10px; }
.feature h3 { font-size: 1rem; }
.feature p { font-size: .88rem; margin: 0; }

.quote { max-width: 720px; margin: 40px auto; padding: 26px 30px; border-left: 3px solid var(--accent); background: var(--bg-card); border-radius: 0 var(--radius) var(--radius) 0; }
.quote p { font-style: italic; color: var(--text); font-size: 1.05rem; }
.quote cite { color: var(--text-mute); font-style: normal; }

/* auth */
.auth-wrap { max-width: 420px; margin: 50px auto; }
.auth-wrap .card { padding: 30px; }
.auth-switch { text-align: center; margin-top: 18px; color: var(--text-mute); }
.auth-switch a { color: var(--accent); font-weight: 600; }
.errors { background: rgba(214, 36, 74, .08); border: 1px solid rgba(214, 36, 74, .28); border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; list-style: none; }
.errors li { color: var(--expense); font-size: .88rem; }

.empty { text-align: center; padding: 40px 20px; color: var(--text-mute); }
.empty .ico { font-size: 2.4rem; margin-bottom: 10px; }

.subnav { display: flex; gap: 8px; margin-bottom: 22px; flex-wrap: wrap; }
.subnav a { padding: 8px 16px; border-radius: 10px; background: var(--bg-card); border: 1px solid var(--border); font-weight: 600; font-size: .9rem; color: var(--text-dim); }
.subnav a.active { background: var(--accent-soft); color: #fff; border-color: transparent; }
