/* ==========================================================================
   Uptime Monitor — shared design system
   ========================================================================== */

:root {
    --bg: #0a0d14;
    --bg-soft: #0d1119;
    --surface: #131826;
    --surface-2: #182035;
    --border: #232c40;
    --border-soft: #1b2233;
    --text: #eef1f8;
    --text-dim: #9aa4bc;
    --text-faint: #616d87;

    --accent: #6f7bf7;
    --accent-2: #8f97ff;
    --accent-soft: rgba(111, 123, 247, 0.14);
    --accent-glow: rgba(111, 123, 247, 0.35);

    --up: #29d489;
    --up-soft: rgba(41, 212, 137, 0.14);
    --down: #f5576c;
    --down-soft: rgba(245, 87, 108, 0.14);
    --warn: #ffb648;
    --warn-soft: rgba(255, 182, 72, 0.14);
    --unknown: #8b93ab;
    --unknown-soft: rgba(139, 147, 171, 0.14);

    --radius-lg: 18px;
    --radius: 14px;
    --radius-sm: 10px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
    --shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.45);

    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color-scheme: dark;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font);
    background:
        radial-gradient(1100px 520px at 12% -10%, rgba(111, 123, 247, 0.16), transparent 60%),
        radial-gradient(900px 480px at 110% 10%, rgba(143, 151, 255, 0.08), transparent 55%),
        var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}

a { color: inherit; }

::selection { background: var(--accent-glow); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-soft); }

/* ---------------------------------------------------------------------- */
/* Topbar                                                                  */
/* ---------------------------------------------------------------------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    background: rgba(10, 13, 20, 0.72);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    border-bottom: 1px solid var(--border-soft);
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
    text-decoration: none;
    white-space: nowrap;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), #b18cff);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08) inset, 0 6px 18px var(--accent-glow);
    font-size: 17px;
}

.topbar-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    /* Держит навигацию сразу после логотипа слева независимо от того, есть ли
       .topbar-right на странице — без этого при двух детях topbar их раскидывает
       justify-content:space-between по краям, а при трёх (с .topbar-right) навигация
       остаётся слева. Итог был то слева, то справа в зависимости от страницы. */
    margin-right: auto;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    flex-wrap: wrap;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-dim);
    font-size: 14px;
    font-weight: 600;
    transition: background 0.15s ease, color 0.15s ease;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: var(--accent-soft); color: var(--accent-2); }

/* User menu: chip (avatar + name) that opens a dropdown with Настройки / Выйти */
.user-menu { position: relative; }

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px 6px 6px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 13px;
    font-family: inherit;
    color: var(--text-dim);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.user-chip:hover { background: var(--surface-2); border-color: var(--border-soft); }
.user-chip .avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #b18cff);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    flex: none;
}
.user-chip-caret {
    font-size: 9px;
    color: var(--text-faint);
    transition: transform 0.15s ease;
    margin-left: 1px;
}
.user-menu.open .user-chip-caret { transform: rotate(180deg); }

.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 180px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 60;
}
.user-menu.open .user-menu-dropdown { opacity: 1; pointer-events: auto; transform: translateY(0); }

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 9px 10px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s ease;
}
.user-menu-item:hover { background: var(--surface-2); }
.user-menu-item-danger { color: var(--down); }
.user-menu-item-danger:hover { background: var(--down-soft); }

.container {
    max-width: 1320px;
    margin: 0 auto;
    padding: 28px 24px 64px;
}

.page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}
.page-heading h1 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.page-heading p {
    color: var(--text-dim);
    font-size: 13.5px;
    margin-top: 4px;
}

/* ---------------------------------------------------------------------- */
/* Buttons                                                                 */
/* ---------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    min-height: 40px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    filter: none;
    transform: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #7d87ff);
    color: #fff;
    box-shadow: 0 6px 20px var(--accent-glow);
}
.btn-primary:hover { filter: brightness(1.08); }

.btn-ghost {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--border);
}
.btn-ghost:hover { background: var(--border-soft); border-color: var(--border-soft); }

.btn-outline {
    background: transparent;
    color: var(--text-dim);
    border-color: var(--border);
}
.btn-outline:hover { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }

.btn-success { background: var(--up-soft); color: var(--up); border-color: transparent; }
.btn-success:hover { background: var(--up); color: #06301c; }

/* Сплошной, а не приглушённо-пастельный, как остальные — иначе кнопка "Удалить"
   ничем не выделяется среди других экшенов на карточке и легко жмётся не глядя */
.btn-danger { background: var(--down); color: #fff; border-color: transparent; }
.btn-danger:hover { background: #d63652; }

/* Для карточек сайтов: "Удалить" — редкое, необратимое, но НЕ главное действие на
   карточке — не должно перетягивать взгляд от статуса/метрик. Нейтральная по умолчанию,
   краснеет только при наведении — акцент остаётся на более важных кнопках рядом. */
.btn-quiet-danger { background: transparent; color: var(--text-faint); border-color: var(--border); }
.btn-quiet-danger:hover { background: var(--down-soft); color: var(--down); border-color: rgba(245, 87, 108, 0.35); }

.btn-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.btn-warn:hover { background: var(--warn); color: #422a00; }

.btn-sm { min-height: 34px; padding: 7px 12px; font-size: 12.5px; border-radius: 8px; }
.btn-icon { padding: 8px; min-width: 40px; }
.btn-block { width: 100%; }

/* ---------------------------------------------------------------------- */
/* Cards / surfaces                                                        */
/* ---------------------------------------------------------------------- */

.panel {
    background: linear-gradient(180deg, var(--surface), var(--surface) 60%, var(--bg-soft));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

/* ---------------------------------------------------------------------- */
/* Forms                                                                   */
/* ---------------------------------------------------------------------- */

.field { margin-bottom: 18px; }
.field label {
    display: block;
    margin-bottom: 7px;
    color: var(--text-dim);
    font-size: 13px;
    font-weight: 600;
}
.input {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-soft);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-family: inherit;
    color: var(--text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.input::placeholder { color: var(--text-faint); }
.input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--surface-2);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

/* ---------------------------------------------------------------------- */
/* Toggle switch                                                           */
/* ---------------------------------------------------------------------- */

.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-track {
    position: absolute; inset: 0; cursor: pointer;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.switch-track::before {
    content: '';
    position: absolute;
    height: 16px; width: 16px;
    left: 3px; top: 50%;
    transform: translateY(-50%);
    background: var(--text-dim);
    border-radius: 50%;
    transition: transform 0.15s ease, background 0.15s ease;
}
.switch input:checked + .switch-track { background: var(--accent-soft); border-color: var(--accent); }
.switch input:checked + .switch-track::before { transform: translate(18px, -50%); background: var(--accent); }
.switch input:disabled + .switch-track { opacity: 0.5; cursor: not-allowed; }

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px 16px;
    flex-wrap: wrap;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-soft);
}
.settings-row:last-child { border-bottom: none; }
.settings-row-label { font-size: 14px; font-weight: 600; color: var(--text); }
.settings-row-sub { font-size: 12.5px; color: var(--text-faint); margin-top: 3px; }
.settings-row-control { display: flex; align-items: center; gap: 10px; flex: none; }

.settings-section { padding: 22px 24px; border-radius: var(--radius-lg); margin-bottom: 18px; }
.settings-section h3 { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.settings-section > .settings-section-sub { color: var(--text-faint); font-size: 12.5px; margin-bottom: 6px; }

.select {
    padding: 9px 12px;
    background: var(--bg-soft);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
}
.select:focus { outline: none; border-color: var(--accent); }

.time-input {
    padding: 8px 10px;
    background: var(--bg-soft);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 13.5px;
    width: 92px;
}
.time-input:focus { outline: none; border-color: var(--accent); }

/* ---------------------------------------------------------------------- */
/* Auth screen                                                             */
/* ---------------------------------------------------------------------- */

.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 24px;
}
.auth-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 40px;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}
.auth-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
    margin-bottom: 26px;
}
.auth-logo .brand-mark { width: 44px; height: 44px; border-radius: 13px; font-size: 22px; }
.auth-card h2 { text-align: center; margin-bottom: 8px; font-size: 21px; font-weight: 700; }
.auth-sub { text-align: center; color: var(--text-dim); font-size: 13.5px; margin-bottom: 26px; }

.auth-button { margin-top: 4px; }
.auth-link {
    text-align: center;
    margin-top: 22px;
    color: var(--text-dim);
    font-size: 13.5px;
    cursor: pointer;
    transition: color 0.15s ease;
}
.auth-link span { color: var(--accent-2); font-weight: 600; }
.auth-link:hover { color: var(--text); }

.error {
    background: var(--down-soft);
    color: #ff9aa6;
    border: 1px solid rgba(245, 87, 108, 0.3);
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    font-size: 13.5px;
    display: none;
}

/* ---------------------------------------------------------------------- */
/* Add-site form                                                           */
/* ---------------------------------------------------------------------- */

.add-form {
    padding: 18px;
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: stretch;
}
.add-form input { min-width: 200px; }
.add-form select#checkType { flex: 0 0 240px; }
.add-form input#siteUrl { flex: 2; }
.add-form input#siteName { flex: 1.3; }
.add-form input#checkInterval { flex: 0 0 130px; }
.add-form button { flex: 0 0 auto; }

.check-config-block { gap: 10px; flex: 1 1 100%; flex-wrap: wrap; }
.check-config-block input, .check-config-block select { min-width: 160px; flex: 1; }
.check-config-block textarea#apiBody { flex: 1 1 100%; min-width: 100%; resize: vertical; font-family: var(--font); padding: 10px 14px; }

/* Кнопка-триггер и хедер формы добавления — задействуются только на мобильных (см. медиа-запрос) */
.add-form-toggle { display: none; }
.add-form-head { display: none; }
.add-form-overlay { display: contents; }

/* Индикатор использования лимита тарифа — виден постоянно, а не только в момент отказа добавить сайт */
.plan-usage-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dim);
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.plan-usage-bar.warning { border-color: rgba(255, 182, 72, 0.35); background: var(--warn-soft); color: var(--warn); }
.plan-usage-bar.danger { border-color: rgba(245, 87, 108, 0.35); background: var(--down-soft); color: var(--down); }
.plan-usage-link { color: inherit; font-weight: 700; text-decoration: underline; white-space: nowrap; }

.pending-change-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 14px 18px;
    border-radius: var(--radius);
    background: var(--warn-soft);
    border: 1px solid rgba(255, 182, 72, 0.35);
    color: var(--warn);
    font-size: 13.5px;
    font-weight: 600;
    margin-bottom: 24px;
}
.pending-change-banner > div:first-child { color: var(--text); font-weight: 500; }

.infra-health-banner {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius);
    background: var(--warn-soft);
    border: 1px solid rgba(255, 182, 72, 0.35);
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 20px;
}
.infra-health-banner.visible { display: flex; }
.infra-health-banner .infra-health-icon { font-size: 16px; flex-shrink: 0; }

.plan-gate-warning {
    flex: 1 1 100%;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--warn-soft);
    border: 1px solid rgba(255, 182, 72, 0.35);
    color: var(--warn);
    font-size: 13px;
    font-weight: 600;
}

/* ---------------------------------------------------------------------- */
/* Sites grid + cards                                                      */
/* ---------------------------------------------------------------------- */

.sites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 18px;
}

.site-card {
    padding: 22px;
    border-radius: var(--radius-lg);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    display: flex;
    flex-direction: column;
}
.site-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    border-color: var(--border-soft);
}

/* Упавший сайт должен быть виден даже боковым зрением в сетке из десятков карточек —
   не только маленькая плашка статуса, а вся карточка целиком */
.site-card.site-card-down {
    animation: card-alert 2s ease-in-out infinite;
}
.site-card.site-card-down:hover { animation-play-state: paused; }
@keyframes card-alert {
    0%, 100% { border-color: var(--border); box-shadow: var(--shadow-sm); }
    50% { border-color: rgba(245, 87, 108, 0.55); box-shadow: 0 0 0 3px rgba(245, 87, 108, 0.16); }
}

.site-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 6px;
}
.site-card-title { display: flex; align-items: center; gap: 4px; min-width: 0; }
.site-card h3 { font-size: 16.5px; font-weight: 700; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.site-card.is-favorite {
    border-color: rgba(255, 182, 72, 0.45);
    box-shadow: 0 0 0 1px rgba(255, 182, 72, 0.25), var(--shadow-sm);
}

.star-btn {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-faint);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    border-radius: 8px;
    transition: color 0.15s ease, transform 0.12s ease, background 0.15s ease;
}
.star-btn:hover { color: var(--warn); background: var(--warn-soft); }
.star-btn:active { transform: scale(0.9); }
.star-btn.active { color: var(--warn); text-shadow: 0 0 12px rgba(255, 182, 72, 0.5); }
.site-url {
    color: var(--text-faint);
    margin-bottom: 14px;
    word-break: break-all;
    font-size: 13px;
}

.check-type-badge {
    display: inline-flex;
    align-items: center;
    background: var(--surface-2);
    color: var(--text-dim);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    white-space: nowrap;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 12.5px;
    white-space: nowrap;
}
.pill::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 8px currentColor;
}
.pill.up { background: var(--up-soft); color: var(--up); }
.pill.down { background: var(--down-soft); color: var(--down); }
.pill.unknown { background: var(--unknown-soft); color: var(--unknown); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.pending { background: var(--accent-soft); color: var(--accent-2); }
.pill.pending::before { animation: pulse-dot 1.1s ease-in-out infinite; }
@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

/* Упавший сайт должен бросаться в глаза даже среди десятков разноцветных плашек —
   маленькой точки недостаточно, поэтому "моргает" расходящимся кольцом сама плашка */
.pill.down,
.status-badge.status-down {
    animation: alert-pulse 1.6s ease-out infinite;
}
@keyframes alert-pulse {
    0% { box-shadow: 0 0 0 0 rgba(245, 87, 108, 0.45); }
    70% { box-shadow: 0 0 0 7px rgba(245, 87, 108, 0); }
    100% { box-shadow: 0 0 0 0 rgba(245, 87, 108, 0); }
}

/* Skeleton loader — shown only while a value has never been checked yet */
.skeleton {
    display: inline-block;
    height: 13px;
    width: 44px;
    border-radius: 5px;
    vertical-align: middle;
    background: linear-gradient(90deg, var(--border-soft) 25%, var(--surface-2) 37%, var(--border-soft) 63%);
    background-size: 400% 100%;
    animation: skeleton-shimmer 1.3s ease infinite;
}
.skeleton-sm { width: 32px; height: 11px; }
.skeleton-lg { width: 60px; height: 15px; }
.skeleton-block { display: block; width: 100%; height: 44px; border-radius: var(--radius-sm); }
@keyframes skeleton-shimmer {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

/* Static placeholder for a value that was actually checked but is genuinely absent */
.value-empty {
    color: var(--text-faint);
    font-weight: 500;
}

.metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 16px 0 4px;
    padding: 16px 0;
    border-top: 1px solid var(--border-soft);
}
.metric { text-align: center; }
.metric-label { font-size: 11px; color: var(--text-faint); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.04em; }
.metric-value { font-size: 16px; font-weight: 700; color: var(--text); }

.extended-info {
    margin: 4px 0 16px;
    padding: 14px;
    background: var(--bg-soft);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
.info-item { text-align: center; }
.info-label { font-size: 10.5px; color: var(--text-faint); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.04em; }
.info-value { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.info-subvalue { font-size: 10px; color: var(--text-faint); margin-top: 2px; white-space: nowrap; }
.td-stack { display: inline-block; }

.ssl-warning, .ssl-danger, .ssl-ok { font-weight: 700; }
.ssl-warning { color: var(--warn); }
.ssl-danger { color: var(--down); }
.ssl-ok { color: var(--up); }

.actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: auto;
    padding-top: 4px;
}
.actions .btn { padding-left: 8px; padding-right: 8px; font-size: 12.5px; }

.loading, .empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 64px 20px;
    color: var(--text-faint);
    font-size: 14.5px;
}
.empty-state .empty-icon { font-size: 34px; display: block; margin-bottom: 12px; }

.spinner {
    width: 22px; height: 22px;
    border-radius: 50%;
    border: 2.5px solid var(--border);
    border-top-color: var(--accent);
    animation: spin 0.8s linear infinite;
    display: inline-block;
    vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------------- */
/* Summary cards (dashboard overview)                                      */
/* ---------------------------------------------------------------------- */

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.summary-card {
    padding: 18px 20px;
    border-radius: var(--radius-lg);
    text-align: left;
    display: flex;
    align-items: center;
    gap: 14px;
}
.summary-card .summary-icon {
    width: 42px; height: 42px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 19px;
    background: var(--surface-2);
    flex-shrink: 0;
}
.summary-card-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.summary-value { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.summary-label { color: var(--text-dim); font-size: 12.5px; font-weight: 600; }
.up { color: var(--up); }
.down { color: var(--down); }

/* Есть недоступные сайты — эта карточка не должна теряться среди четырёх соседних */
.summary-card.summary-card-alert {
    background: var(--down-soft);
    animation: card-alert 2s ease-in-out infinite;
}
.summary-card.summary-card-alert .summary-icon { background: rgba(245, 87, 108, 0.18); }
.warning { color: var(--warn); }

/* ---------------------------------------------------------------------- */
/* Table (overview)                                                        */
/* ---------------------------------------------------------------------- */

.sites-table { border-radius: var(--radius-lg); overflow: hidden; }
tbody tr.is-favorite { background: rgba(255, 182, 72, 0.05); }
tbody tr.is-favorite:hover { background: rgba(255, 182, 72, 0.09); }
.table-site-name { display: flex; align-items: center; gap: 4px; }
.table-site-name .star-btn { margin-left: -6px; }

/* Card-based fallback for the overview table on narrow screens (see .sites-cards-mobile) */
.sites-cards-mobile { display: none; }
.extended-info-2 { grid-template-columns: repeat(2, 1fr); }
.actions-3 { grid-template-columns: repeat(3, 1fr); }

table { width: 100%; border-collapse: collapse; }
th {
    background: var(--surface-2);
    padding: 14px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
}
td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-soft);
    font-size: 14px;
    vertical-align: middle;
}
tbody tr { transition: background 0.15s ease; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
td strong { font-weight: 700; }
td small { color: var(--text-faint); }

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    white-space: nowrap;
}
.status-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 6px currentColor; }
.status-up { background: var(--up-soft); color: var(--up); }
.status-down { background: var(--down-soft); color: var(--down); }
.status-unknown { background: var(--unknown-soft); color: var(--unknown); }
.status-pending { background: var(--accent-soft); color: var(--accent-2); }
.status-pending::before { animation: pulse-dot 1.1s ease-in-out infinite; }

.table-actions { display: flex; gap: 6px; }
.action-btn {
    width: 32px; height: 32px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--border);
    background: var(--surface-2);
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}
.action-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.action-btn:active { transform: scale(0.93); }
.action-btn.danger:hover { border-color: var(--down); background: var(--down-soft); }
.action-btn:disabled {
    width: auto;
    padding: 0 8px;
    gap: 4px;
    opacity: 0.55;
    cursor: not-allowed;
    font-size: 11.5px;
    font-weight: 600;
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
/* Индикатор WebSocket-соединения (живые обновления вместо опроса) */
.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 12px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--text-faint);
}
.live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-faint);
    flex: none;
}
.live-indicator.connected { color: var(--up); border-color: rgba(41, 212, 137, 0.25); }
.live-indicator.connected .live-dot { background: var(--up); box-shadow: 0 0 8px var(--up); animation: pulse-dot 1.6s ease-in-out infinite; }
.live-indicator.connecting { color: var(--warn); border-color: rgba(255, 182, 72, 0.25); }
.live-indicator.connecting .live-dot { background: var(--warn); animation: pulse-dot 0.8s ease-in-out infinite; }
.live-indicator.offline { color: var(--down); border-color: rgba(245, 87, 108, 0.25); }
.live-indicator.offline .live-dot { background: var(--down); }

/* ---------------------------------------------------------------------- */
/* Admin panel shell (sidebar layout)                                      */
/* ---------------------------------------------------------------------- */

.admin-shell { display: flex; min-height: 100vh; align-items: stretch; }

.admin-sidebar {
    width: 240px;
    flex: none;
    background: var(--bg-soft);
    border-right: 1px solid var(--border-soft);
    padding: 18px 14px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
    overflow-y: auto;
}
.admin-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px 18px;
    text-decoration: none;
    color: var(--text);
    font-weight: 700;
    font-size: 15px;
}
.admin-sidebar-brand .brand-mark { width: 30px; height: 30px; border-radius: 9px; font-size: 15px; }
.admin-nav-group-label {
    padding: 14px 12px 6px;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-faint);
}
.admin-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 600;
    transition: background 0.15s ease, color 0.15s ease;
}
.admin-nav-link:hover { background: var(--surface-2); color: var(--text); }
.admin-nav-link.active { background: var(--accent-soft); color: var(--accent-2); }
.admin-nav-icon { width: 18px; text-align: center; flex: none; }

.admin-sidebar-footer {
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid var(--border-soft);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.admin-content { flex: 1; min-width: 0; padding: 26px 32px 64px; }
.admin-content .page-heading { margin-bottom: 22px; }

.admin-mobile-bar { display: none; }

/* Компактные варианты уже существующих карточек/бейджей — переиспользуются в разделах админки */
.admin-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}
.admin-table-wrap { overflow-x: auto; border-radius: var(--radius-lg); }
.admin-table-wrap table { min-width: 640px; }
.admin-filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; align-items: center; }
.admin-filters .input, .admin-filters .select { max-width: 220px; }
.admin-pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 18px; }
.role-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px; border-radius: 999px;
    font-size: 11px; font-weight: 700;
}
.role-badge.admin { background: var(--accent-soft); color: var(--accent-2); }
.role-badge.suspended { background: var(--down-soft); color: var(--down); }
.plan-badge {
    display: inline-flex; align-items: center;
    padding: 3px 10px; border-radius: 999px;
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
}
.plan-badge.free { background: var(--unknown-soft); color: var(--unknown); }
.plan-badge.solo { background: var(--accent-soft); color: var(--accent-2); }
.plan-badge.seo_pro { background: var(--up-soft); color: var(--up); }
.plan-badge.team { background: var(--warn-soft); color: var(--warn); }

@media (max-width: 960px) {
    .admin-sidebar { display: none; }
    .admin-mobile-bar {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 12px 16px;
        background: rgba(10, 13, 20, 0.9);
        border-bottom: 1px solid var(--border-soft);
        position: sticky;
        top: 0;
        z-index: 40;
        overflow-x: auto;
    }
    .admin-mobile-bar .admin-nav-link { white-space: nowrap; }
    .admin-content { padding: 20px 16px 48px; }
}

/* ---------------------------------------------------------------------- */
/* Stats page: site status header + domain/SSL                            */
/* ---------------------------------------------------------------------- */

.site-pulse {
    padding: 22px 24px;
    border-radius: var(--radius-lg);
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}
.site-pulse-main {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}
.site-pulse-info { min-width: 0; }
.site-pulse-info h2 {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.01em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 360px;
}
.site-pulse-url { color: var(--text-faint); font-size: 12.5px; margin-top: 2px; }

/* "Пульс" — статус сайта в реальном времени: расходящееся кольцо для "работает",
   статичный тусклый индикатор для "недоступен", мигающий — для "проверяем" */
.status-pulse {
    position: relative;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex: none;
    background: var(--unknown);
}
.status-pulse.up { background: var(--up); box-shadow: 0 0 10px var(--up); }
.status-pulse.up::after {
    content: '';
    position: absolute;
    inset: -7px;
    border-radius: 50%;
    border: 2px solid var(--up);
    animation: pulse-ring 1.8s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
.status-pulse.down { background: var(--down); box-shadow: 0 0 10px var(--down); }
.status-pulse.pending { background: var(--accent-2); box-shadow: 0 0 10px var(--accent-glow); animation: pulse-dot 1.1s ease-in-out infinite; }
.status-pulse.unknown { background: var(--unknown); }
@keyframes pulse-ring {
    0% { transform: scale(0.7); opacity: 0.9; }
    100% { transform: scale(2.1); opacity: 0; }
}

.site-pulse-meta {
    display: flex;
    align-items: center;
    gap: 22px;
    flex-wrap: wrap;
}
.site-pulse-meta-item { display: flex; flex-direction: column; gap: 3px; }
.meta-label { font-size: 10.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.04em; }
.meta-value { font-size: 13.5px; font-weight: 700; color: var(--text); white-space: nowrap; }

.domain-ssl-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.domain-ssl-card { padding: 20px 22px; border-radius: var(--radius-lg); }
.domain-ssl-head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 12px;
}
.domain-ssl-icon { font-size: 15px; }
.domain-ssl-value { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 4px; }
.domain-ssl-sub { color: var(--text-faint); font-size: 12.5px; }

.info-hint {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--text-faint);
    font-size: 10px;
    font-weight: 700;
    text-transform: none;
    letter-spacing: normal;
    cursor: help;
    margin-left: -2px;
    z-index: 10;
}
.info-hint::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: 220px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    text-transform: none;
    letter-spacing: normal;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    opacity: 0;
    visibility: hidden;
    transition: opacity .15s ease;
    z-index: 20;
    pointer-events: none;
}
.info-hint:hover::after,
.info-hint:focus::after {
    opacity: 1;
    visibility: visible;
}

/* ---------------------------------------------------------------------- */
/* Stats page                                                              */
/* ---------------------------------------------------------------------- */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}
.stat-card { padding: 18px; border-radius: var(--radius-lg); text-align: left; }
.stat-label { color: var(--text-dim); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px; }
.stat-value { font-size: 25px; font-weight: 800; letter-spacing: -0.02em; background: linear-gradient(135deg, var(--accent-2), #fff); -webkit-background-clip: text; background-clip: text; color: transparent; }

.chart-container { padding: 22px; border-radius: var(--radius-lg); margin-bottom: 18px; }
.chart-container h3 { margin-bottom: 18px; color: var(--text); font-size: 15px; font-weight: 700; }
.chart-wrapper { position: relative; height: 300px; width: 100%; }

.period-selector {
    display: inline-flex;
    padding: 4px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    gap: 2px;
    margin-bottom: 22px;
    max-width: 100%;
    overflow-x: auto;
}
.period-selector button {
    padding: 9px 18px;
    border: none;
    background: transparent;
    color: var(--text-dim);
    border-radius: 999px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13.5px;
    font-family: inherit;
    white-space: nowrap;
    transition: background 0.2s ease, color 0.2s ease;
}
.period-selector button.active { background: var(--accent); color: #fff; box-shadow: 0 4px 14px var(--accent-glow); }
.period-selector button:not(.active):hover { color: var(--text); background: var(--surface-2); }

.error-message {
    background: var(--down-soft);
    color: #ff9aa6;
    border: 1px solid rgba(245, 87, 108, 0.3);
    padding: 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    text-align: center;
    font-size: 14px;
}

/* ---------------------------------------------------------------------- */
/* Modal + Toast                                                           */
/* ---------------------------------------------------------------------- */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 7, 12, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    max-width: 480px;
    width: 100%;
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    transform: translateY(8px) scale(0.98);
    transition: transform 0.18s ease;
}
.modal-overlay.open .modal-box { transform: translateY(0) scale(1); }
.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-soft);
}
.modal-head h3 { font-size: 15.5px; font-weight: 700; }
.modal-close {
    width: 30px; height: 30px;
    border-radius: 8px;
    border: none;
    background: var(--surface-2);
    color: var(--text-dim);
    cursor: pointer;
    font-size: 15px;
    display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { color: var(--text); background: var(--border-soft); }
.modal-body { padding: 18px 20px; overflow-y: auto; font-size: 13.5px; }

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-soft);
}
.history-item:last-child { border-bottom: none; }
.history-time { color: var(--text-dim); font-size: 12.5px; }
.history-meta { display: flex; gap: 12px; color: var(--text-faint); font-size: 11.5px; margin-top: 3px; flex-wrap: wrap; }

.check-result-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 14px;
}
.check-result-item {
    background: var(--bg-soft);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    padding: 12px;
}
.check-result-item .k { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.check-result-item .v { font-size: 14.5px; font-weight: 700; }

.seo-checklist { display: flex; flex-direction: column; gap: 8px; }
.seo-check-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
    border: 1px solid var(--border-soft);
}
.seo-check-icon { font-size: 14px; line-height: 1.4; }
.seo-check-label { font-size: 13px; font-weight: 700; color: var(--text); }
.seo-check-detail { font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }
.seo-check-item.seo-check-fail { border-color: rgba(245, 87, 108, 0.3); background: var(--down-soft); }
.seo-check-item.seo-check-warn { border-color: rgba(255, 182, 72, 0.3); background: var(--warn-soft); }
.seo-check-item.seo-check-info { border-color: rgba(111, 123, 247, 0.3); background: var(--accent-soft); }

.seo-report-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.seo-report-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.seo-report-checked-at { font-size: 12px; color: var(--text-faint); }
.seo-report-summary { display: flex; gap: 8px; }
.seo-summary-chip { font-size: 12.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--text-dim); }
.seo-summary-chip.pass { color: var(--up); }
.seo-summary-chip.warn { color: var(--warn); }
.seo-summary-chip.fail { color: var(--down); }
.seo-checklist-wide { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.seo-upsell { text-align: center; position: relative; }
.seo-upsell h3 { margin-bottom: 10px; }
.seo-upsell p { color: var(--text-dim); font-size: 13.5px; max-width: 480px; margin: 0 auto 18px; line-height: 1.5; }
.upsell-dismiss {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: var(--surface-2);
    color: var(--text-faint);
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.upsell-dismiss:hover { background: var(--border); color: var(--text); }
.security-report-scope { color: var(--text-faint); font-size: 12.5px; margin: -8px 0 16px; }

.toast-stack {
    position: fixed;
    bottom: 20px;
    right: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    z-index: 200;
    pointer-events: none;
}
.toast {
    pointer-events: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    font-size: 13.5px;
    max-width: 360px;
    width: 100%;
    animation: toast-in 0.22s ease;
}
.toast.success { border-left-color: var(--up); }
.toast.error { border-left-color: var(--down); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---------------------------------------------------------------------- */
/* Mobile                                                                  */
/* ---------------------------------------------------------------------- */

@media (max-width: 860px) {
    .container { padding: 20px 16px 48px; }
    .sites-grid { grid-template-columns: 1fr; }
    .add-form { flex-direction: column; }
    .add-form input, .add-form button:not(.modal-close) { width: 100%; flex: none; }

    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .chart-wrapper { height: 240px; }

    /* Обзор: на узких экранах таблица нечитаема — показываем те же карточки, что и на "Сайты" */
    .sites-table { display: none; }
    .sites-cards-mobile { display: grid; }
}

@media (max-width: 640px) {
    .topbar { padding: 13px 16px; }
    .brand span.brand-text { display: none; }
    .page-heading { margin-bottom: 14px; }
    .page-heading h1 { font-size: 17px; }
    .page-heading p { display: none; }
    .auth-card { padding: 30px 22px; }

    .site-pulse { padding: 18px; flex-direction: column; align-items: flex-start; }
    .site-pulse-info h2 { max-width: 200px; }
    .site-pulse-meta { width: 100%; justify-content: space-between; }
    #pulseCheckBtn { flex: 1 1 100%; }
    .domain-ssl-grid { grid-template-columns: 1fr; }

    .settings-section { padding: 18px; }
    .settings-row-control { width: 100%; justify-content: space-between; }

    /* Форма добавления сайта сворачивается в кнопку и всплывающее окно снизу */
    .add-form-toggle { display: flex; width: 100%; margin-bottom: 20px; }
    .add-form-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 100;
        background: rgba(5, 7, 12, 0.6);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.18s ease;
    }
    .add-form-overlay.open { opacity: 1; pointer-events: auto; }
    .add-form-overlay .add-form {
        position: absolute;
        left: 0; right: 0; bottom: 0;
        margin: 0;
        border-radius: 18px 18px 0 0;
        flex-direction: column;
        max-height: 85vh;
        overflow-y: auto;
        transform: translateY(100%);
        transition: transform 0.2s ease;
        padding-bottom: 24px;
    }
    .add-form-overlay.open .add-form { transform: translateY(0); }
    .add-form-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 4px;
    }
    .add-form-head h3 { font-size: 15.5px; font-weight: 700; }
    .metrics { grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .metric-value { font-size: 14px; }
    .extended-info { grid-template-columns: repeat(2, 1fr); padding: 12px; gap: 10px 6px; }
    .info-value { font-size: 11.5px; }
    .actions { grid-template-columns: repeat(2, 1fr); }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }

    /* Обзор: 5 отдельных плиток на телефоне превращаются в один компактный список */
    .summary-cards {
        display: flex;
        flex-direction: column;
        gap: 0;
        background: linear-gradient(180deg, var(--surface), var(--surface) 60%, var(--bg-soft));
        border: 1px solid var(--border);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-sm);
        overflow: hidden;
    }
    .summary-card {
        flex-direction: row;
        align-items: center;
        gap: 12px;
        padding: 13px 16px;
        border: none;
        border-radius: 0;
        border-bottom: 1px solid var(--border-soft);
        background: none;
        box-shadow: none;
    }
    .summary-card:last-child { border-bottom: none; }
    .summary-card .summary-icon { width: 30px; height: 30px; font-size: 14px; flex: none; }
    .summary-card-body { flex-direction: row; align-items: center; flex: 1; gap: 8px; }
    .summary-card .summary-label { margin: 0; }
    .summary-card .summary-value { margin-left: auto; font-size: 17px; }

    .period-selector { width: 100%; justify-content: flex-start; }
    .check-result-grid { grid-template-columns: 1fr 1fr; }
    .toast-stack { left: 12px; right: 12px; bottom: 12px; align-items: stretch; }
    .toast { max-width: none; }
}

@media (max-width: 400px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ==========================================================================
   Landing page
   ========================================================================== */

.lp-body { overflow-x: hidden; }

.lp-accent-text {
    background: linear-gradient(135deg, var(--accent-2), #b18cff 60%, #ff9ad1);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Nav */
.lp-nav {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 16px 32px;
    background: rgba(10, 13, 20, 0.72);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    border-bottom: 1px solid var(--border-soft);
}
.lp-nav-links {
    display: flex;
    gap: 22px;
    margin-right: auto;
    margin-left: 12px;
}
.lp-nav-links a {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: color 0.15s ease;
}
.lp-nav-links a:hover { color: var(--text); }
.lp-nav-actions { display: flex; align-items: center; gap: 10px; }

/* Hero */
.lp-hero {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    align-items: center;
    gap: 48px;
    max-width: 1280px;
    margin: 0 auto;
    padding: 76px 32px 96px;
}
.lp-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--accent-soft);
    border: 1px solid rgba(111, 123, 247, 0.3);
    color: var(--accent-2);
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 22px;
}
.lp-hero-text h1 {
    font-size: 44px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin-bottom: 20px;
}
.lp-hero-sub {
    color: var(--text-dim);
    font-size: 16.5px;
    line-height: 1.65;
    max-width: 540px;
    margin-bottom: 30px;
}
.lp-hero-cta { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.lp-hero-cta .btn { padding: 13px 24px; min-height: 46px; font-size: 15px; }
.lp-hero-trust {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    color: var(--text-faint);
    font-size: 13px;
    font-weight: 600;
}

.lp-hero-visual { position: relative; }
.lp-demo-card {
    padding: 24px;
    box-shadow: var(--shadow-lg);
    transform: rotate(-1.2deg);
}
.lp-demo-card:hover { transform: rotate(0deg) translateY(-3px); }
.lp-live-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    padding: 9px 16px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 12.5px;
    font-weight: 600;
}

/* Generic section shell */
.lp-section {
    max-width: 1280px;
    margin: 0 auto;
    padding: 76px 32px;
}
.lp-section-soft {
    max-width: none;
    background: var(--bg-soft);
    border-top: 1px solid var(--border-soft);
    border-bottom: 1px solid var(--border-soft);
}
.lp-section-soft > * { max-width: 1280px; margin-left: auto; margin-right: auto; }
.lp-section-head { text-align: center; max-width: 560px; margin: 0 auto 44px; }
.lp-section-head h2 { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 10px; }
.lp-section-head p { color: var(--text-dim); font-size: 15.5px; }

/* Features */
#features { position: relative; overflow: hidden; }
#features .lp-section-head, #features .lp-features-grid { position: relative; z-index: 1; }

/* Весь дашборд еле заметным фоном за карточками возможностей — та же идея наклона,
   что и у демо-карточки в hero (.lp-demo-card), только сильно приглушённая и декоративная. */
.lp-dashboard-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1160px;
    max-width: none;
    transform: translate(-50%, -106%) rotate(346deg);
    opacity: 0.3;
    pointer-events: none;
    user-select: none;
    z-index: 0;
}
.lp-dashboard-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 14px; }
.lp-dashboard-sites { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

.lp-features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}
.lp-feature-card { padding: 26px; border-radius: var(--radius-lg); transition: transform 0.2s ease, box-shadow 0.2s ease; }
.lp-feature-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.lp-feature-icon {
    width: 46px; height: 46px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 12px;
    background: var(--accent-soft);
    font-size: 22px;
    margin-bottom: 16px;
}
.lp-feature-card h3 { font-size: 16.5px; font-weight: 700; margin-bottom: 8px; }
.lp-feature-card p { color: var(--text-dim); font-size: 14px; line-height: 1.55; }

/* Steps */
.lp-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}
.lp-step { text-align: center; padding: 0 12px; }
.lp-step-num {
    width: 44px; height: 44px;
    margin: 0 auto 16px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #b18cff);
    color: #fff;
    font-weight: 800;
    font-size: 17px;
    box-shadow: 0 6px 20px var(--accent-glow);
}
.lp-step h3 { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.lp-step p { color: var(--text-dim); font-size: 14px; line-height: 1.55; }

/* Pricing */
.lp-pricing-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    align-items: stretch;
}
.lp-price-card {
    position: relative;
    padding: 30px 26px;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
}
.lp-price-popular {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent), var(--shadow-lg);
    transform: scale(1.03);
}
.lp-price-ribbon {
    position: absolute;
    top: -13px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--accent), #b18cff);
    color: #fff;
    font-size: 11.5px;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 999px;
    box-shadow: 0 6px 16px var(--accent-glow);
    white-space: nowrap;
}
.lp-price-name { font-size: 15px; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 10px; }
.lp-price-value { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.lp-price-amount { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; }
.lp-price-period { color: var(--text-faint); font-size: 13.5px; font-weight: 600; }
.lp-price-desc { color: var(--text-dim); font-size: 13.5px; line-height: 1.5; margin-bottom: 22px; min-height: 40px; }
.lp-price-card > .btn { margin-bottom: 24px; }
.lp-price-features { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.lp-price-features li {
    position: relative;
    padding-left: 26px;
    font-size: 13.5px;
    color: var(--text);
}
.lp-price-features li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--up);
    font-weight: 800;
}
.lp-price-features li.lp-price-everything {
    padding-left: 0;
    color: var(--text-dim);
    font-weight: 700;
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: -2px;
}
.lp-price-features li.lp-price-everything::before { content: none; }
.lp-price-footnote { text-align: center; color: var(--text-faint); font-size: 13px; margin-top: 28px; }

/* Advanced checks (landing) */
.lp-advanced-grid {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 28px;
    align-items: start;
}
.lp-advanced-features {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}
.lp-port-chart { padding: 26px; border-radius: var(--radius-lg); }
.lp-port-chart-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.lp-port-chart-head h3 { font-size: 16px; font-weight: 700; }
.lp-port-rows { display: flex; flex-direction: column; gap: 18px; }
.lp-port-row { display: grid; grid-template-columns: 90px 1fr 56px; align-items: center; gap: 12px; }
.lp-port-label { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--text-dim); white-space: nowrap; }
.lp-port-num { background: var(--surface-2); color: var(--text); font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 6px; }
.lp-port-bar { position: relative; height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.lp-port-bar-fill { position: absolute; inset: 0; border-radius: 999px; background: var(--up); }
.lp-port-bar-fill.warn { background: var(--warn); }
.lp-port-bar-fill.down { background: var(--down); }
.lp-port-value { font-size: 13px; font-weight: 800; text-align: right; }
.lp-port-value.up { color: var(--up); }
.lp-port-value.warn { color: var(--warn); }
.lp-port-value.down { color: var(--down); }

.lp-security-scorecard { padding: 26px; border-radius: var(--radius-lg); }
.lp-security-scorecard-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.lp-security-scorecard-head h3 { font-size: 16px; font-weight: 700; }
.lp-security-summary { display: flex; gap: 8px; }
.lp-security-chip { font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 999px; background: var(--surface-2); color: var(--text-dim); }
.lp-security-chip.pass { color: var(--up); }
.lp-security-chip.warn { color: var(--warn); }
.lp-security-chip.fail { color: var(--down); }
.lp-security-rows { display: flex; flex-direction: column; gap: 10px; }
.lp-security-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
    border: 1px solid var(--border-soft);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dim);
}
.lp-security-row-icon { font-size: 13px; line-height: 1; }
.lp-security-row.pass { color: var(--text); }
.lp-security-row.warn { border-color: rgba(255, 182, 72, 0.3); background: var(--warn-soft); color: var(--text); }
.lp-security-row.info { border-color: rgba(111, 123, 247, 0.3); background: var(--accent-soft); color: var(--text); }

.lp-scanner-disclaimer {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    max-width: 780px;
    margin: 36px auto 0;
    padding: 20px 24px;
    border-radius: var(--radius-lg);
    background: var(--warn-soft);
    border: 1px solid rgba(255, 182, 72, 0.35);
}
.lp-scanner-disclaimer-icon { font-size: 22px; line-height: 1.3; }
.lp-scanner-disclaimer strong { display: block; color: var(--warn); font-size: 14.5px; margin-bottom: 6px; }
.lp-scanner-disclaimer p { color: var(--text-dim); font-size: 13.5px; line-height: 1.6; margin: 0; }
.lp-scanner-disclaimer b { color: var(--text); font-weight: 700; }

/* FAQ */
.lp-faq { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.lp-faq-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
}
.lp-faq-item summary {
    cursor: pointer;
    font-weight: 700;
    font-size: 14.5px;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.lp-faq-item summary::-webkit-details-marker { display: none; }
.lp-faq-item summary::after {
    content: '+';
    color: var(--text-faint);
    font-size: 18px;
    font-weight: 400;
    margin-left: 12px;
    transition: transform 0.15s ease;
}
.lp-faq-item[open] summary::after { content: '−'; }
.lp-faq-item p { color: var(--text-dim); font-size: 13.5px; line-height: 1.6; margin-top: 12px; }

/* Final CTA */
.lp-cta {
    text-align: center;
    max-width: 720px;
    margin: 0 auto;
    padding: 90px 32px 110px;
}
.lp-cta h2 { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 12px; }
.lp-cta p { color: var(--text-dim); font-size: 15.5px; margin-bottom: 28px; }
.lp-cta-btn { padding: 14px 28px; min-height: 48px; font-size: 15.5px; }

/* Footer */
.lp-footer {
    border-top: 1px solid var(--border-soft);
    padding: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    max-width: 1280px;
    margin: 0 auto;
}
.lp-footer-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.lp-footer-links { display: flex; gap: 20px; flex-wrap: wrap; }
.lp-footer-links a { color: var(--text-dim); text-decoration: none; font-size: 13.5px; font-weight: 600; }
.lp-footer-links a:hover { color: var(--text); }
.lp-footer-copy { color: var(--text-faint); font-size: 12.5px; }

@media (max-width: 1180px) and (min-width: 981px) {
    .lp-pricing-grid { grid-template-columns: repeat(2, 1fr); }
    .lp-price-popular { transform: none; }
}

@media (max-width: 980px) {
    .lp-hero { grid-template-columns: 1fr; padding-top: 52px; }
    .lp-hero-visual { order: -1; max-width: 440px; margin: 0 auto; }
    .lp-hero-text h1 { font-size: 34px; }
    .lp-features-grid { grid-template-columns: repeat(2, 1fr); }
    .lp-steps { grid-template-columns: 1fr; gap: 32px; }
    .lp-pricing-grid { grid-template-columns: 1fr; max-width: 420px; margin: 0 auto; }
    .lp-price-popular { transform: none; }
    .lp-advanced-grid { grid-template-columns: 1fr; }
    .lp-dashboard-bg { display: none; }
}

@media (max-width: 640px) {
    .lp-nav { padding: 13px 16px; gap: 12px; }
    .lp-nav-links { display: none; }
    .lp-nav .brand-text { display: none; }
    .lp-nav-actions .btn { padding: 9px 14px; font-size: 13px; }
    .lp-hero { padding: 40px 18px 64px; }
    .lp-hero-text h1 { font-size: 27px; }
    .lp-hero-sub { font-size: 15px; }
    .lp-hero-cta .btn { flex: 1 1 auto; }
    .lp-section { padding: 56px 18px; }
    .lp-section-head h2 { font-size: 24px; }
    .lp-features-grid { grid-template-columns: 1fr; }
    .lp-advanced-features { grid-template-columns: 1fr; }
    .lp-port-row { grid-template-columns: 66px 1fr 50px; gap: 8px; }
    .lp-cta { padding: 64px 18px 80px; }
    .lp-cta h2 { font-size: 24px; }
    .lp-footer { padding: 24px 18px; justify-content: center; text-align: center; }
}
