/* Ghost in the Block
   Логика: токены → одна поверхность → рецепты секций.
   Рецепт меняет форму и акцент, а не копирует стекло целиком. */

:root {
    --ink: rgba(255, 255, 255, 0.92);
    --ink-2: rgba(255, 255, 255, 0.72);
    --ink-3: rgba(255, 255, 255, 0.5);
    --page-0: #0c0c1d;
    --page-1: #16162e;
    --page-2: #1c2744;

    --glass: rgba(255, 255, 255, 0.08);
    --glass-2: rgba(255, 255, 255, 0.03);
    --stroke: rgba(255, 255, 255, 0.14);
    --blur: 18px;
    --r: 16px;
    --r-sm: 10px;
    --r-pill: 999px;
    --pad: 24px;
    --shadow: 0 10px 32px rgba(0, 0, 0, 0.32);
    --lift: 0 18px 44px rgba(0, 0, 0, 0.42);
    --move: 0.22s ease;

    --brand: #7c6cff;
    --brand-2: #c084fc;
    --brand-3: #67e8f9;
    --grad-brand: linear-gradient(135deg, #667eea 0%, #764ba2 48%, #f0abfc 100%);

    --cyan: #22d3ee;
    --rose: #fb7185;
    --teal: #2dd4bf;
    --gold: #facc15;
    --violet: #c084fc;
    --mint: #6ee7b7;
    --orange: #fb923c;
    --pink: #f472b6;
    --green: #4ade80;
    --blue: #60a5fa;

    --primary: #7c6cff;
    --secondary: #22c55e;
    --accent-blue: #22d3ee;
    --accent-cyan: #22d3ee;
    --accent-red: #fb7185;
    --accent-teal: #2dd4bf;
    --accent-yellow: #facc15;
    --accent-purple: #c084fc;
    --accent-mint: #6ee7b7;
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 48%, #f0abfc 100%);
    --secondary-gradient: linear-gradient(135deg, #12122a 0%, #1b2744 100%);
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-bg-light: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.14);
    --glass-blur: blur(18px);
    --text-primary: rgba(255, 255, 255, 0.92);
    --text-secondary: rgba(255, 255, 255, 0.72);
    --text-muted: rgba(255, 255, 255, 0.5);
    --text-accent: rgba(255, 255, 255, 0.78);
    --border-light: rgba(124, 108, 255, 0.22);
    --border-medium: rgba(124, 108, 255, 0.38);
    --border-radius: 16px;
    --shadow-primary: 0 10px 32px rgba(0, 0, 0, 0.32);
    --shadow-hover: 0 18px 44px rgba(0, 0, 0, 0.42);
    --transition: 0.22s ease;
    --text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
    --bg-accent: rgba(124, 108, 255, 0.16);
}

*, *::before, *::after { box-sizing: border-box; }
a { color: inherit; }
a, a:hover, a:focus, a:active, a:visited { text-decoration: none !important; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    line-height: 1.6;
    font-family: Inter, "Segoe UI", Tahoma, sans-serif;
    background:
        radial-gradient(1200px 500px at 10% -10%, rgba(124, 108, 255, 0.22), transparent 55%),
        radial-gradient(900px 420px at 100% 0%, rgba(34, 211, 238, 0.12), transparent 50%),
        linear-gradient(165deg, var(--page-0), var(--page-1) 42%, var(--page-2));
}

.container { max-width: 1400px; margin: 0 auto; padding: 20px; }

/* --- примитив: стекло --- */
.surface,
.glass-card,
.activity-card,
.social-card,
.full-width-card,
.hourly-card,
.search-form-card,
.export-form-card {
    background: linear-gradient(160deg, var(--glass), var(--glass-2));
    backdrop-filter: blur(var(--blur));
    border: 1px solid var(--stroke);
    border-radius: var(--r);
    box-shadow: var(--shadow);
}

.glass-card,
.activity-card,
.social-card,
.full-width-card,
.hourly-card,
.search-form-card,
.export-form-card { padding: var(--pad); }

.full-width-card { margin-bottom: 24px; border-top: 3px solid var(--violet); }
.hourly-card { margin-bottom: 28px; border-top: 3px solid var(--teal); border-radius: 12px; }
.social-dark {
    background: linear-gradient(160deg, #1b1028, #141a33) !important;
    border-color: rgba(251, 113, 133, 0.28);
}
.search-form-card { border-left: 3px solid var(--cyan); margin-bottom: 28px; }
.export-form-card { border-left: 3px solid var(--green); padding: 30px; }
.results-stats,
.view-stats {
    margin-bottom: 20px;
    padding: 0 0 12px 14px;
    background: none;
    box-shadow: none;
    border: 0;
    border-left: 3px solid var(--brand);
    border-radius: 0;
}
.view-stats { border-left-color: var(--green); }
.view-navigation,
.search-pagination-wrapper {
    margin: 24px 0;
    padding: 0;
    background: none;
    border: 0;
    box-shadow: none;
}

.icon-tile,
.card-icon,
.activity-icon,
.social-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.15em;
    background: var(--grad-brand);
    box-shadow: 0 6px 16px rgba(124, 108, 255, 0.35);
}

.card-icon.blue,
.activity-icon.blue { background: linear-gradient(135deg, #3b82f6, #8b5cf6); }
.activity-icon.purple { background: linear-gradient(135deg, #8b5cf6, #ec4899); }
.activity-icon.orange { background: linear-gradient(135deg, #f97316, #facc15); }
.card-icon.teal,
.activity-icon.teal { background: linear-gradient(135deg, #14b8a6, #22d3ee); }
.card-icon.fire,
.activity-icon.fire { background: linear-gradient(135deg, #fb7185, #fbbf24); }
.social-icon.primary,
.activity-icon.primary { background: linear-gradient(135deg, #2563eb, #22d3ee); }
.social-icon.pink,
.activity-icon.pink { background: linear-gradient(135deg, #a21caf, #f472b6); }

.card-header,
.activity-header,
.social-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.card-title,
.activity-title,
.social-title {
    margin: 0;
    color: var(--ink);
    font-size: 1.3em;
    font-weight: 650;
}

/* --- шапка: сплошной градиент, не стекло --- */
.header {
    position: relative;
    overflow: hidden;
    margin-bottom: 36px;
    padding: 42px 30px;
    text-align: center;
    color: #fff;
    border-radius: 24px;
    background: var(--grad-brand);
    box-shadow: 0 22px 50px rgba(102, 126, 234, 0.32);
}
.header::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.18;
    background-image: radial-gradient(circle at 18% 30%, #fff 1px, transparent 1.5px),
        radial-gradient(circle at 78% 68%, #fff 1px, transparent 1.5px);
    background-size: 42px 42px;
}
.header h1 { position: relative; margin: 0 0 8px; font-size: 2.45em; font-weight: 800; }
.header p { position: relative; margin: 0; opacity: 0.92; font-size: 1.08em; }

.tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-bottom: 32px;
}
.tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 26px;
    color: var(--ink-2);
    font-weight: 650;
    border: 1px solid var(--stroke);
    border-radius: var(--r-pill);
    background: linear-gradient(160deg, var(--glass), var(--glass-2));
    backdrop-filter: blur(var(--blur));
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
    transition: transform var(--move), box-shadow var(--move), background var(--move);
}
.tab:hover {
    transform: translateY(-2px);
    color: var(--ink);
    background: rgba(255, 255, 255, 0.14);
}
.tab.active {
    color: #fff;
    border-color: transparent;
    background: var(--grad-brand);
    box-shadow: 0 8px 24px rgba(124, 108, 255, 0.45);
}
.tab-content { display: none; background: none; box-shadow: none; }
.tab-content.active,
.reaction-link { display: block; }

.section-separator {
    position: relative;
    height: 1px;
    margin: 40px 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22), transparent);
}
.section-separator::after {
    content: attr(data-label);
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    padding: 2px 16px;
    font-size: 0.78em;
    font-weight: 600;
    color: var(--ink-2);
    border: 1px solid var(--stroke);
    border-radius: var(--r-pill);
    background: var(--secondary-gradient);
}

.charts-grid,
.activity-grid,
.social-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-bottom: 28px; }
.search-results-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 18px; }
.view-messages-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }

.social-note { margin-top: 18px; text-align: center; }
.social-note small { color: var(--ink-3); font-size: 0.85em; }

/* --- статистика: тонированные плитки, не одинаковое стекло --- */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 36px;
}
.stat-card {
    --tone: var(--cyan);
    position: relative;
    overflow: hidden;
    padding: 22px 16px;
    text-align: center;
    border-radius: 18px;
    border: 1px solid color-mix(in srgb, var(--tone) 42%, var(--stroke));
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--tone) 20%, transparent), var(--glass-2));
    box-shadow: 0 10px 24px color-mix(in srgb, var(--tone) 18%, transparent);
    transition: transform var(--move), box-shadow var(--move);
}
.stat-card::after {
    content: "";
    position: absolute;
    left: 18%;
    right: 18%;
    top: 0;
    height: 3px;
    border-radius: 0 0 8px 8px;
    background: var(--tone);
}
.stat-blue { --tone: var(--cyan); }
.stat-red { --tone: var(--rose); }
.stat-teal { --tone: var(--teal); }
.stat-yellow { --tone: var(--gold); }
.stat-purple { --tone: var(--violet); }
.stat-mint { --tone: var(--mint); }
.stat-card:hover { transform: translateY(-5px); box-shadow: 0 16px 32px color-mix(in srgb, var(--tone) 28%, transparent); }
.stat-number {
    margin-bottom: 8px;
    font-size: 2em;
    font-weight: 800;
    line-height: 1.1;
    color: var(--tone);
    text-shadow: 0 0 18px color-mix(in srgb, var(--tone) 70%, transparent);
}
.stat-card div:last-child { color: var(--ink-2); font-weight: 600; font-size: 0.9em; }

/* --- кнопки --- */
.btn,
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 22px;
    color: #fff;
    font-weight: 650;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    background: var(--grad-brand);
    box-shadow: 0 6px 16px rgba(124, 108, 255, 0.35);
    transition: transform var(--move), box-shadow var(--move);
}
.btn:hover,
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(124, 108, 255, 0.45); }
.btn-success {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    box-shadow: 0 6px 16px rgba(34, 197, 94, 0.35);
}
.btn-secondary {
    background: linear-gradient(135deg, #64748b, #475569);
    box-shadow: 0 6px 16px rgba(71, 85, 105, 0.35);
}
.btn-back-to-search,
.btn-nav-message {
    display: inline-flex;
    padding: 8px 16px;
    color: #fff;
    font-weight: 600;
    font-size: 0.9em;
    border: 1px solid var(--stroke);
    border-radius: 10px;
    transition: transform var(--move);
}
.btn-back-to-search { background: linear-gradient(135deg, #64748b, #475569); }
.btn-nav-message { background: linear-gradient(135deg, #16a34a, #22c55e); }
.btn-back-to-search:hover,
.btn-nav-message:hover { transform: translateY(-1px); }

.view-message-actions .view-message-btn,
.search-message-actions .search-view-btn,
.search-view-btn {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: var(--r-pill);
    font-size: 0.75em;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #16a34a, #22d3ee);
    border: 1px solid rgba(34, 197, 94, 0.35);
    box-shadow: 0 3px 10px rgba(34, 197, 94, 0.28);
    position: relative;
    z-index: 1;
}
.form-label { display: block; margin-bottom: 8px; font-weight: 700; color: var(--ink); font-size: 0.9em; }

/* --- годы: горизонтальные дорожки --- */
.chart-container { display: flex; flex-direction: column; gap: 10px; }
.chart-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 0;
}
.chart-label,
.chart-value {
    min-width: 48px;
    font-weight: 750;
    background: none;
}
.chart-value { min-width: 64px; text-align: right; }
.chart-track {
    flex: 1;
    height: 22px;
    overflow: hidden;
    border-radius: var(--r-pill);
    background: rgba(0, 0, 0, 0.28);
}
.chart-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #6366f1, #22d3ee);
    box-shadow: 0 0 12px rgba(34, 211, 238, 0.35);
}

/* --- дни: вертикальные колонны --- */
.day-grid-full { display: grid; grid-template-columns: repeat(7, 1fr); gap: 12px; margin-top: 16px; }
.day-card-full { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.day-bar {
    width: 100%;
    height: 118px;
    position: relative;
    overflow: hidden;
    border-radius: 18px 18px 8px 8px;
    background: rgba(192, 132, 252, 0.12);
}
.day-fill {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    border-radius: 14px 14px 8px 8px;
    background: linear-gradient(180deg, #e879f9, #7c3aed);
    box-shadow: 0 0 16px rgba(192, 132, 252, 0.4);
}
.day-name-full { font-size: 0.8em; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-2); }
.day-count-full { font-weight: 750; color: var(--ink); }

/* --- месяцы: цветные плитки --- */
.month-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 10px; }
.month-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 4px;
    text-align: center;
    background: none;
    border: 0;
}
.month-name { font-size: 0.78em; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-2); }
.month-count {
    font-size: 1.15em;
    font-weight: 800;
    color: var(--month-color, var(--ink));
    text-shadow: 0 0 10px var(--month-color, transparent);
}

/* --- часы: узкие столбики --- */
.hourly-note { margin-top: 12px; text-align: center; }
.hourly-note small { color: var(--ink-3); font-size: 0.8em; }
.hourly-container { margin-top: 18px; }
.hourly-chart { display: flex; align-items: flex-end; gap: 5px; height: 140px; padding: 0 6px; }
.hour-bar { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.hour-fill {
    width: 100%;
    min-height: 18px;
    height: var(--hour-height, 24px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    border-radius: 4px 4px 0 0;
    background: linear-gradient(180deg, #5eead4, #0f766e);
    box-shadow: 0 4px 10px rgba(45, 212, 191, 0.28);
}
.hour-fill:hover { filter: brightness(1.12); }
.hour-fill span { margin-bottom: 4px; font-size: 0.68em; font-weight: 800; color: #fff; }
.hour-label { margin-top: 6px; font-size: 0.68em; font-weight: 650; color: var(--ink-2); }

/* --- сообщения --- */
.message-header,
.view-message-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 14px;
}
.message-header-left,
.view-message-header-left { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.message-header-right { margin-left: 8px; }
.message-title,
.view-message-title { margin: 0; font-size: 1.05rem; font-weight: 700; color: var(--ink); }
.message-meta,
.view-message-meta { font-size: 0.85rem; color: var(--ink-3); }
.message-content { color: var(--ink-2); line-height: 1.5; max-height: 300px; overflow: hidden; flex: 1; }
.view-message-content { color: var(--ink); line-height: 1.65; margin-bottom: 14px; }
.message-link {
    color: var(--cyan);
    font-weight: 650;
    border-bottom: 1px dashed color-mix(in srgb, var(--cyan) 50%, transparent);
}
.current-indicator { color: var(--green); font-size: 0.8em; font-weight: 700; }

.view-message-card,
.search-result-card {
    position: relative;
    padding: 22px;
    border-radius: 16px;
    border: 1px solid var(--stroke);
    background: linear-gradient(160deg, var(--glass), var(--glass-2));
    backdrop-filter: blur(var(--blur));
    box-shadow: var(--shadow);
    transition: border-color var(--move), box-shadow var(--move), transform var(--move);
}
.search-result-card { min-height: 320px; display: flex; flex-direction: column; }
.search-card-hit { position: absolute; inset: 0; z-index: 0; border-radius: inherit; }
.search-result-card a:not(.search-card-hit) { position: relative; z-index: 1; }
.search-result-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--cyan) 50%, var(--stroke)); }
.view-message-card { border-width: 2px; border-color: transparent; }
.view-message-card:hover {
    border-color: var(--cyan);
    box-shadow: 0 10px 28px rgba(34, 211, 238, 0.16);
}
.view-message-card.current {
    border-color: var(--green);
    background: linear-gradient(160deg, rgba(74, 222, 128, 0.16), var(--glass-2));
    box-shadow: 0 10px 28px rgba(74, 222, 128, 0.18);
}
.view-message-footer,
.search-message-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.view-message-actions,
.search-message-actions { margin-left: auto; }
.view-message-reaction-item,
.message-reaction-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 0;
    border: 0;
    background: none;
    font-size: 0.8em;
    color: var(--ink-2);
}
.message-reactions-list,
.view-message-reactions { display: flex; flex-wrap: wrap; gap: 6px; }

/* --- медиа --- */
.view-message-media { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.media-item { padding: 0; border: 0; background: none; }
.photo-item, .sticker-item, .video-sticker-item, .video-item { text-align: center; }
.media-image, .media-sticker { max-width: 100%; max-height: 300px; border-radius: 8px; }
.media-video { max-width: 100%; border-radius: 8px; }
.media-info { margin-top: 6px; font-size: 12px; color: var(--ink-3); }
.sticker-emoji { display: block; margin-top: 8px; font-size: 22px; }
.animated-sticker-placeholder {
    padding: 18px;
    text-align: center;
    border-radius: 12px;
    border: 2px dashed rgba(244, 114, 182, 0.4);
    background: rgba(168, 85, 247, 0.12);
}
.fancy-photo { position: relative; margin-bottom: 12px; }
.photo-container { overflow: hidden; border-radius: 12px; }
.fancy-image { display: block; width: 100%; max-height: 350px; object-fit: scale-down; }
.photo-overlay {
    position: absolute; left: 0; right: 0; bottom: 0;
    padding: 12px;
    opacity: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
    transition: opacity var(--move);
}
.fancy-photo:hover .photo-overlay { opacity: 1; }
.media-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: var(--r-pill);
    font-size: 0.75em;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #16a34a, #22c55e);
}

/* --- реакции дашборда: тёмные плитки --- */
.reactions-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.reaction-card {
    position: relative;
    padding: 8px 4px;
    background: none;
    border: 0;
    cursor: pointer;
}
.reaction-card-overlay,
.reaction-glow { display: none; }
.reaction-card-content { position: relative; z-index: 1; }
.reaction-header { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.reaction-emoji {
    width: 34px; height: 34px; display: grid; place-items: center;
    border-radius: 50%;
    background: linear-gradient(135deg, #fb7185, #facc15);
}
.reaction-rank { padding: 2px 8px; border-radius: 10px; font-size: 0.8em; font-weight: 750; background: rgba(255, 255, 255, 0.1); }
.reaction-votes { font-size: 1.7em; font-weight: 800; line-height: 1.1; }
.reaction-votes-label, .reaction-messages { font-size: 0.8em; color: var(--ink-3); }
.reaction-glow {
    position: absolute; inset: -2px; opacity: 0;
    background: linear-gradient(135deg, rgba(251, 113, 133, 0.35), rgba(250, 204, 21, 0.25));
    transition: opacity var(--move);
}
.reaction-card:hover .reaction-glow { opacity: 1; }

/* --- теги: две формы --- */
.tags-container { display: flex; flex-wrap: wrap; gap: 8px; }
.hashtag-link,
.mention-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    border-radius: var(--r-pill);
    font-weight: 600;
    position: relative;
    overflow: hidden;
    transition: transform var(--move), box-shadow var(--move);
}
.hashtag-link {
    border: 0;
    background: rgba(34, 211, 238, 0.14);
}
.mention-link {
    border: 0;
    border-radius: 10px;
    background: rgba(244, 114, 182, 0.14);
}
.hashtag-link:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(34, 211, 238, 0.25); }
.mention-link:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(244, 114, 182, 0.25); }
.hashtag-link span,
.mention-link span { padding: 0; background: none; color: var(--ink-3); font-weight: 600; }

/* --- пагинация --- */
.search-pagination-wrapper { margin: 32px 0; padding: 0; background: none; border: 0; box-shadow: none; }
.search-pagination-info { text-align: center; margin-bottom: 14px; }
.pagination-info-text { font-size: 14px; color: var(--ink-2); }
.pagination-info-text strong {
    background: var(--grad-brand);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.search-pagination { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; }
.pagination-numbers { display: flex; gap: 6px; margin: 0 6px; }
.pagination-btn {
    min-width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    font-weight: 650;
    border: 1px solid var(--stroke);
    border-radius: 10px;
    background: var(--glass);
    transition: transform var(--move), background var(--move);
}
.pagination-btn:hover { transform: translateY(-1px); background: rgba(255, 255, 255, 0.14); }
.pagination-btn-active {
    color: #fff;
    border-color: transparent;
    background: var(--grad-brand);
    box-shadow: 0 6px 16px rgba(124, 108, 255, 0.4);
}
.pagination-btn-nav { background: rgba(124, 108, 255, 0.16); }
.pagination-btn-disabled { opacity: 0.4; pointer-events: none; }
.pagination-ellipsis { padding: 0 6px; color: var(--ink-3); }

.search-page-header,
.view-page-header,
.export-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}
.search-page-hint,
.export-page-hint { font-size: 12px; color: var(--ink-3); }
.search-form { display: flex; flex-direction: column; gap: 18px; }
.search-input-row { display: flex; gap: 12px; align-items: stretch; }
.search-input,
.export-date-input {
    width: 100%;
    padding: 12px 14px;
    color: #fff;
    border: 1px solid var(--stroke);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.22);
}
.search-input { flex: 1; min-width: 200px; }
.search-input:focus { outline: 0; border-color: var(--cyan); box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.2); }
.search-tips { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--stroke); }
.search-tips-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; font-size: 13px; }
.search-tips strong { color: var(--cyan); }
.results-stats-header,
.view-stats-header { margin: 0 0 4px; font-size: 18px; }
.results-stats-info,
.view-stats-info { opacity: 0.9; }
.results-stats-hint,
.view-stats-hint { font-size: 12px; opacity: 0.8; }

.view-navigation { margin-top: 28px; }
.view-nav-content { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.view-nav-right { display: flex; gap: 8px; }

.export-card { max-width: 800px; margin: 0 auto; }
.export-form { display: grid; gap: 18px; }
.export-dates-row { display: flex; gap: 16px; align-items: end; }
.export-date-group { flex: 1; }
.export-date-label { display: block; margin-bottom: 4px; font-size: 12px; color: var(--ink-2); }
.export-info { margin: 8px 0 0; padding: 0; border: 0; background: none; }
.export-info-title { margin: 0 0 8px; font-size: 16px; }
.export-info-list { margin: 0; padding-left: 18px; color: var(--ink-2); }
.export-tip { margin-top: 12px; color: var(--ink-2); }
.export-button { text-align: center; margin-top: 8px; }

.error-message,
.message {
    margin: 10px 0;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid rgba(251, 113, 133, 0.35);
    background: rgba(251, 113, 133, 0.12);
}
.message:not(.error-message) {
    border-color: rgba(74, 222, 128, 0.35);
    background: rgba(74, 222, 128, 0.12);
}
.empty-state {
    max-width: 520px;
    margin: 40px auto;
    padding: 48px 20px;
    text-align: center;
    border-radius: 16px;
    border: 1px dashed var(--stroke);
    background: var(--glass);
}
.empty-state-icon { font-size: 56px; margin-bottom: 12px; }
.empty-state-title { margin: 0 0 8px; font-size: 22px; }
.empty-state-description { color: var(--ink-2); }

.no-text-message { color: var(--ink-3); }
.view-message-header-right { text-align: right; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.text-sm { font-size: 0.875em; }
.text-xl { font-size: 1.25em; }
.text-secondary { color: var(--ink-2); }
.mb-3 { margin-bottom: 28px; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-3 { gap: 12px; }

.section-title,
.search-page-title,
.view-page-title,
.export-page-title { margin: 0; font-size: 1.4em; font-weight: 750; color: var(--ink); }
.section-subtitle { margin: 6px 0 0; color: var(--ink-2); font-size: 0.95em; }
.section-hint { font-size: 0.85em; color: var(--ink-3); }

/* --- chain: бейджи читаемые на тёмном --- */
.semantic-mini-timeline { margin-bottom: 24px; padding: 0; border: 0; background: none; }
.timeline-track { position: relative; height: 6px; margin-bottom: 10px; border-radius: 3px; background: var(--border-medium); }
.timeline-point { position: absolute; top: 50%; transform: translate(-50%, -50%); }
.point-circle {
    width: 12px; height: 12px; margin: 0 auto 4px;
    border-radius: 50%;
    background: var(--cyan);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.25);
}
.point-label { display: block; font-size: 0.85rem; text-align: center; }
.timeline-label { text-align: center; color: var(--ink-2); font-size: 0.85rem; }

.semantic-insights { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.semantic-badge,
.intelligence-badge,
.category-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--r-pill);
    font-size: 0.75rem;
    font-weight: 650;
    color: #e9d5ff;
    background: rgba(168, 85, 247, 0.22);
    border: 0;
}
.sentiment-badge { color: #cbd5e1; background: rgba(148, 163, 184, 0.18); border: 0; }
.sentiment-positive { color: #86efac; background: rgba(74, 222, 128, 0.18); border-color: rgba(74, 222, 128, 0.35); }
.sentiment-negative { color: #fda4af; background: rgba(251, 113, 133, 0.18); border-color: rgba(251, 113, 133, 0.35); }
.sentiment-neutral { color: #cbd5e1; background: rgba(148, 163, 184, 0.16); }
.sentiment- { color: #94a3b8; }
.similarity-indicator { color: var(--cyan); font-weight: 700; }
.keyword-highlight {
    padding: 0 4px;
    border-radius: 6px;
    font-weight: 700;
    color: var(--ink);
    border: 0;
    background: rgba(99, 102, 241, 0.28);
}
a.keyword-highlight:hover { border-color: var(--cyan); }

.similarity-breakdown-compact,
.connection-details {
    display: grid;
    gap: 8px;
    margin-top: 10px;
    padding: 0;
    border: 0;
    background: none;
}
.metric-compact { display: grid; gap: 4px; }
.metric-header { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; }
.metric-name { flex: 1; color: var(--ink-2); }
.metric-score { color: var(--cyan); font-weight: 700; }
.metric-bar-mini { height: 6px; overflow: hidden; border-radius: 3px; background: rgba(255, 255, 255, 0.12); }
.metric-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, #6366f1, #22d3ee); }

.shared-elements { display: grid; gap: 8px; }
.element-group { display: flex; align-items: flex-start; gap: 8px; }
.element-list { display: flex; flex-wrap: wrap; gap: 6px; }
.element-tag {
    display: inline-flex;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ink);
    border: 0;
    background: rgba(124, 108, 255, 0.14);
}
.entity-tag { color: #86efac; background: rgba(74, 222, 128, 0.14); }
.topic-tag { color: #fdba74; background: rgba(251, 146, 60, 0.14); }
.keyword-tag { color: #e9d5ff; background: rgba(168, 85, 247, 0.16); }

.semantic-insights-advanced {
    display: grid;
    gap: 10px;
    padding: 0;
    border: 0;
    background: none;
}
.context-summary { display: flex; gap: 8px; }
.context-text { font-size: 0.85rem; font-style: italic; color: var(--ink-2); }
.highlight-item {
    display: inline;
    padding: 0;
    border: 0;
    background: none;
    font-size: 0.85rem;
    font-style: italic;
    color: var(--ink-2);
}

/* --- дашборд связей --- */
.chain-intelligent-dashboard {
    margin: 0 0 32px;
    padding: 8px 0 4px;
    border: 0;
    background: none;
    box-shadow: none;
}
.chain-dashboard-grid { display: grid; gap: 28px; }
.chain-metric-group {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--stroke);
}
.chain-metric-card {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 0;
    border: 0;
    background: none;
}
.chain-metric-card.primary { border: 0; background: none; }
.chain-metric-icon { font-size: 1.1rem; }
.chain-metric-value { display: block; font-size: 1.45rem; font-weight: 800; color: var(--cyan); line-height: 1.1; }
.chain-metric-label { font-size: 0.78rem; color: var(--ink-3); }
.chain-analysis-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 48px;
    row-gap: 22px;
    align-items: start;
}
.chain-analysis-card {
    min-width: 0;
    padding: 0;
    border: 0;
    background: none;
}
.chain-analysis-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.chain-analysis-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-3);
}
.chain-analysis-badges { display: flex; flex-wrap: wrap; gap: 8px 14px; min-width: 0; }
.chain-content-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
    font-size: 0.9rem;
    font-weight: 650;
    border: 0;
    overflow-wrap: anywhere;
}
.chain-content-badge.category { color: var(--cyan); background: none; }
.chain-content-badge.sentiment { color: #e9d5ff; background: none; }
.chain-content-badge.tone-gold { color: var(--gold); background: none; }
.chain-link-types-badges { display: flex; flex-wrap: wrap; gap: 16px 24px; }
.chain-type-badge { display: flex; align-items: baseline; gap: 6px; padding: 0; border: 0; background: none; }
.chain-type-count { font-weight: 800; color: var(--cyan); }
.chain-type-icon { font-size: 0.8rem; color: var(--ink-3); }
.chain-dashboard-decoration { display: none; }

.chain-container { min-width: 0; }
.chain-metric-content { flex: 1; }
.chain-analysis-icon,
.context-icon,
.element-icon,
.highlights-icon,
.metric-icon { font-size: 1.05rem; }
.chain-decoration-wave { height: 100%; }
.text-highlights,
.highlights-list { display: grid; gap: 6px; }
.results-stats-title,
.view-stats-title { margin: 0 0 4px; font-size: 18px; font-weight: 700; }
.pagination-icon { font-weight: 800; }

@media (max-width: 768px) {
    .container { padding: 14px; }
    .header { padding: 28px 16px; border-radius: 18px; }
    .header h1 { font-size: 1.8em; }
    .charts-grid,
    .activity-grid,
    .social-grid,
    .chain-dashboard-header,
    .export-dates-row,
    .view-nav-content { grid-template-columns: 1fr; flex-direction: column; }
    .chain-dashboard-header { display: flex; text-align: center; }
    .chain-metric-group,
    .chain-analysis-grid { grid-template-columns: 1fr; }
    .day-grid-full { grid-template-columns: repeat(4, 1fr); }
    .day-bar { height: 80px; }
    .search-input-row,
    .view-message-header,
    .view-message-footer { flex-direction: column; align-items: stretch; }
    .tab { padding: 10px 16px; }
    .btn { width: 100%; }
    .view-message-card { padding: 16px; }
}
