:root {
    --icon-accent: var(--accent, #4aa3f0);
}
    --bg: #17212b;
    --card: #1f2c38;
    --card-2: #24333f;
    --text: #f2f6fa;
    --muted: #8fa3b3;
    --accent: #4aa3f0;
    --up: #4cd07d;
    --down: #ff6b6b;
    --radius: 14px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    padding: 0 0 76px;
    background:
        radial-gradient(120% 60% at 15% -15%, rgba(74, 163, 240, 0.22) 0%, rgba(74, 163, 240, 0) 60%),
        linear-gradient(180deg, var(--bg) 0%, #101821 100%);
    background-attachment: fixed;
    color: var(--text);
    font: 15px/1.45 -apple-system, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 14px 16px 10px;
    background: linear-gradient(180deg, var(--bg) 70%, rgba(23, 33, 43, 0.85));
    backdrop-filter: blur(6px);
}

.refresh {
    background: none;
    border: none;
    color: var(--muted);
    padding: 6px;
    line-height: 0;
}

.refresh svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.8;
}

.refresh:active { transform: scale(0.94); }
.refresh.spinning { animation: spin 0.8s linear infinite; }

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.title { font-size: 20px; font-weight: 600; }
.subtitle { color: var(--muted); font-size: 12px; margin-top: 2px; }

#content { padding: 8px 12px 0; }

.card {
    background: linear-gradient(180deg, var(--card) 0%, var(--card-2) 140%);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius);
    padding: 13px 14px;
    margin-bottom: 10px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

.card h3 {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 7px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.row:last-child { border-bottom: none; }
.row .name { color: var(--text); }
.row .value { font-variant-numeric: tabular-nums; font-weight: 600; }
.row .symbol { color: var(--muted); font-size: 12px; margin-left: 6px; }

.up { color: var(--up); }
.down { color: var(--down); }
.muted { color: var(--muted); }

.total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 18px;
    font-weight: 600;
    margin-top: 6px;
}

.mini { font-size: 12px; color: var(--muted); margin-top: 4px; }

.news-item { padding: 10px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.news-item:last-child { border-bottom: none; }
.news-item a { color: var(--text); text-decoration: none; font-weight: 500; }
.news-item .meta { color: var(--muted); font-size: 12px; margin-top: 4px; }
.tags { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
    background: var(--card-2);
    color: var(--accent);
    border-radius: 999px;
    padding: 2px 9px;
    font-size: 11px;
}

.alert-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.alert-row button {
    background: transparent;
    border: 1px solid rgba(255, 107, 107, 0.5);
    color: var(--down);
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 12px;
}

.tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    background: var(--card);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 5px 2px calc(6px + env(safe-area-inset-bottom, 0px));
}

.tab {
    flex: 1 1 0;
    min-width: 0;
    background: none;
    border: none;
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 0;
}

.tab svg {
    width: 26px;
    height: 26px;
}

.tab-label {
    display: none;   /* подписи в меню убраны: остались только иконки */
}

/* Иконки набора: контур наследует цвет текста, акцент — общий акцент приложения. */
.icon-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}
.icon-inline svg {
    width: auto;
    height: auto;
    vertical-align: -3px;
}

.tab.active { color: var(--accent); }

.loading, .error {
    padding: 24px 8px;
    text-align: center;
    color: var(--muted);
}

.error { color: var(--down); }

.sparkline { width: 100%; height: 70px; margin-top: 8px; }
.sparkline path { fill: none; stroke: var(--accent); stroke-width: 2; }
.sparkline .area { fill: rgba(74, 163, 240, 0.18); stroke: none; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pill {
    background: var(--card-2);
    border-radius: 10px;
    padding: 8px 10px;
}
.pill .label { color: var(--muted); font-size: 11px; }
.pill .amount { font-weight: 600; font-variant-numeric: tabular-nums; }

/* Значок инструмента вместо эмодзи: цвет зависит от вида актива. */
.badge {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    background: #3a4a5a;
}

.badge.crypto { background: linear-gradient(140deg, #f7931a, #b26a00); }
.badge.share { background: linear-gradient(140deg, #2f80ed, #17539b); }
.badge.index { background: linear-gradient(140deg, #27ae60, #14663a); }
.badge.currency { background: linear-gradient(140deg, #9b51e0, #5d2b8c); }
.badge.commodity { background: linear-gradient(140deg, #d4a017, #8a6708); }

.row { align-items: center; gap: 10px; }
.row .left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.row .left .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.card h3 svg {
    width: 15px;
    height: 15px;
    vertical-align: -2px;
    margin-right: 5px;
    stroke-width: 2;
}

/* Управление алертами прямо в приложении. */
.field {
    width: 100%;
    box-sizing: border-box;
    background: var(--bg);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    color: var(--text);
    font-size: 15px;
    padding: 10px 12px;
    margin-bottom: 8px;
}

.btn {
    background: var(--accent);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    padding: 10px 14px;
    width: 100%;
}

.btn.secondary {
    background: var(--card-2);
    color: var(--text);
    font-weight: 500;
}

.btn:active { transform: scale(0.985); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    background: var(--card-2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    color: var(--text);
    font-size: 13px;
    padding: 7px 12px;
}
.chip.up { color: var(--up); }
.chip.down { color: var(--down); }

.news-title { font-weight: 500; }
.news-item .arrow { color: var(--accent); font-size: 12px; }

/* Лента: картинка поста слева, текст справа. */
.news-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.news-item:last-child { border-bottom: none; }
.news-item .news-body { min-width: 0; flex: 1; }
.news-thumb {
    width: 62px;
    height: 62px;
    flex: 0 0 62px;
    border-radius: 10px;
    object-fit: cover;
    background: var(--card-2);
}

/* Кнопки действий: график, экспорт, добавление. */
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.actions .btn { width: auto; flex: 1 1 40%; font-size: 13px; padding: 9px 10px; }

.chart { width: 100%; height: 150px; display: block; margin-top: 6px; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; }
.chart .area { fill: rgba(74, 163, 240, 0.16); stroke: none; }
.chart .axis { stroke: rgba(255, 255, 255, 0.12); stroke-width: 1; }
.chart .label { fill: var(--muted); font-size: 9px; }

/* Чтение поста прямо в приложении. */
.reader h3 { margin: 0 0 8px; font-size: 17px; }
.reader .meta { margin-bottom: 10px; }
.reader .text { white-space: pre-wrap; font-size: 15px; line-height: 1.5; }
