* {
    box-sizing: border-box;
}
body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, Segoe UI, sans-serif;
    background: #f6f8fb;
    color: #152033;
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
}
a {
    color: inherit;
    text-decoration: none;
}

/* -------------------------------------------------------------------------
   Шапка и улучшенное меню навигации
   ------------------------------------------------------------------------- */
.top {
    min-height: 64px;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px max(24px, calc((100% - 1180px)/2));
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    gap: 16px;
}
.brand {
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -.6px;
    white-space: nowrap;
    color: #0f172a;
}
.brand span {
    color: #2563eb;
    font-weight: 700;
}
.top nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.top nav a {
    display: inline-flex;
    align-items: center;
    font-size: 13.5px;
    font-weight: 500;
    color: #475569;
    padding: 7px 14px;
    border-radius: 8px;
    transition: all .15s ease-in-out;
    white-space: nowrap;
    text-decoration: none;
}
.top nav a:hover {
    color: #0f172a;
    background: #f1f5f9;
}
/* Подсветка активной страницы */
.top nav a.active,
.top nav a[style*="font-weight:600"],
.top nav a[style*="font-weight: 600"] {
    color: #0f172a !important;
    background: #e2e8f0 !important;
    font-weight: 600 !important;
}
/* Кнопка выхода */
.top nav a[href*="logout"] {
    color: #94a3b8;
    margin-left: 6px;
}
.top nav a[href*="logout"]:hover {
    color: #dc2626;
    background: #fef2f2;
}

/* -------------------------------------------------------------------------
   Кнопки и базовые элементы
   ------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 10px;
    background: #172338;
    color: #fff;
    padding: 12px 18px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 8px 22px #17233818;
    text-align: center;
    white-space: nowrap;
}
.btn.ghost {
    background: #fff;
    color: #172338;
    border: 1px solid #dce3ec;
    box-shadow: none;
}
.badge {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 20px;
    background: #e9eef7;
    color: #42536e;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .8px;
}

/* -------------------------------------------------------------------------
   Главная страница (Hero / Preview)
   ------------------------------------------------------------------------- */
.hero {
    max-width: 1180px;
    margin: 0 auto;
    padding: 60px 20px 50px;
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    gap: 40px;
    align-items: center;
}
.hero h1 {
    font-size: 48px;
    line-height: 1.1;
    letter-spacing: -1.5px;
    margin: 16px 0;
    word-break: normal;
    overflow-wrap: break-word;
}
.lead {
    font-size: 17px;
    line-height: 1.6;
    color: #5d6a7d;
    max-width: 650px;
    margin: 0;
}
.actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 28px;
    flex-wrap: wrap;
}
.textlink {
    font-weight: 700;
    font-size: 14px;
}
.preview {
    display: flex;
    justify-content: center;
    width: 100%;
}
.panel {
    background: #fff;
    border: 1px solid #e5eaf1;
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 18px 50px #1c2a3d0d;
    box-sizing: border-box;
}
.preview .panel {
    width: 100%;
    max-width: 430px;
}
.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.ok {
    font-size: 12px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 8px;
    background: #eef7f1;
    color: #166534;
}
.score {
    margin: 25px 0 10px;
}
.score strong {
    font-size: 60px;
    letter-spacing: -3px;
    line-height: 1;
}
.score small {
    color: #8591a2;
    font-size: 16px;
}
.meter {
    height: 8px;
    background: #e8edf3;
    border-radius: 10px;
    overflow: hidden;
}
.meter i {
    display: block;
    height: 100%;
    background: #172338;
    border-radius: 10px;
}
.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 24px;
}
.stats div {
    padding: 10px 8px;
    background: #f7f9fc;
    border-radius: 10px;
    text-align: center;
}
.stats b {
    display: block;
    font-size: 18px;
}
.stats span {
    display: block;
    font-size: 11px;
    color: #738096;
    margin-top: 3px;
}
.how {
    max-width: 1180px;
    margin: auto;
    padding: 20px 20px 70px;
}
.how h2 {
    font-size: 28px;
    margin-bottom: 24px;
}
.cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.card {
    background: #fff;
    border: 1px solid #e5eaf1;
    border-radius: 14px;
    padding: 22px;
}
.card > b {
    font-size: 12px;
    color: #77849a;
}
.card h3 {
    font-size: 19px;
    margin: 10px 0;
}
.card p, .muted {
    color: #6b7789;
    line-height: 1.55;
    font-size: 14px;
}
footer {
    text-align: center;
    padding: 26px 16px;
    color: #8893a4;
    font-size: 13px;
}

/* -------------------------------------------------------------------------
   Формы и авторизация
   ------------------------------------------------------------------------- */
.auth {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 16px;
}
.authbox {
    width: 100%;
    max-width: 440px;
    background: #fff;
    border: 1px solid #e3e9f0;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 20px 60px #1b2a3d0c;
}
.authbox.wide {
    max-width: 620px;
}
.authbox h1 {
    margin: 20px 0 10px;
    font-size: 24px;
}
.authbox form {
    margin-top: 18px;
}
label {
    display: block;
    font-weight: 600;
    font-size: 13.5px;
    margin: 14px 0 6px;
}
label small {
    font-weight: 400;
    color: #8a94a4;
}
input, select, textarea {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid #d9e1eb;
    border-radius: 8px;
    font: inherit;
    font-size: 14px;
    background: #fff;
    box-sizing: border-box;
}
hr {
    border: 0;
    border-top: 1px solid #e7ecf2;
    margin: 20px 0;
}
.error {
    background: #fff0f0;
    border: 1px solid #ffd5d5;
    color: #a22b2b;
    border-radius: 8px;
    padding: 11px;
    margin: 12px 0;
    font-size: 13px;
}

/* -------------------------------------------------------------------------
   Панель управления (Dashboard / Карточки сайтов)
   ------------------------------------------------------------------------- */
.dash {
    max-width: 1180px;
    margin: auto;
    padding: 30px 16px 70px;
}
.dash-head, .sitehero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}
.dash h1 {
    font-size: 30px;
    letter-spacing: -.8px;
    margin: 8px 0;
}
.empty {
    text-align: center;
    background: #fff;
    border: 1px dashed #cfd8e5;
    border-radius: 14px;
    padding: 40px 16px;
}
.sitecard {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border: 1px solid #e3e9f0;
    border-radius: 12px;
    padding: 16px;
    margin: 10px 0;
    gap: 10px;
}
.sitecard span {
    display: block;
    color: #758196;
    font-size: 12.5px;
    margin-top: 4px;
    word-break: break-all;
}
.status {
    font-size: 12px;
    font-weight: 700;
    background: #eef2f7;
    border-radius: 7px;
    padding: 5px 8px;
    white-space: nowrap;
}
.grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 20px 0;
}
.metric {
    background: #fff;
    border: 1px solid #e3e9f0;
    border-radius: 12px;
    padding: 16px;
}
.metric span {
    display: block;
    color: #748095;
    font-size: 12px;
}
.metric b {
    display: block;
    font-size: 28px;
    margin-top: 8px;
}
.issue {
    display: flex;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid #edf0f4;
}
.issue:last-child {
    border-bottom: 0;
}
.issue p {
    margin: 4px 0 0;
    color: #6d7889;
    font-size: 13px;
}
.sev {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    border-radius: 6px;
    padding: 4px 6px;
    height: max-content;
}
.sev.critical { background: #fff0f0; color: #a22b2b; }
.sev.warning  { background: #fff6e5; color: #8a5b00; }
.sev.info     { background: #edf4ff; color: #355e9a; }
.kv {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 14px;
    border-top: 1px solid #edf0f4;
    padding-top: 15px;
}
.kv span {
    color: #748095;
}

/* -------------------------------------------------------------------------
   Мобильная адаптация (смартфоны и планшеты)
   ------------------------------------------------------------------------- */
@media (max-width: 860px) {
    .hero {
        grid-template-columns: 1fr;
        padding: 40px 16px 40px;
        gap: 32px;
    }
    .hero h1 {
        font-size: 32px;
        line-height: 1.15;
        letter-spacing: -1px;
    }
    .lead {
        font-size: 15.5px;
    }
    .cards, .grid {
        grid-template-columns: 1fr;
    }
    .dash-head, .sitehero {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }
    .top {
        padding: 12px 16px;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .top nav {
        justify-content: flex-start;
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 6px;
        gap: 6px;
        -webkit-overflow-scrolling: touch;
    }
    .top nav a {
        padding: 6px 11px;
        font-size: 13px;
        background: #f8fafc;
        border: 1px solid #e2e8f0;
    }
    .actions {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .actions .btn {
        width: 100%;
    }
    .actions .textlink {
        text-align: center;
        padding: 6px 0;
    }
    .stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }
    .stats div {
        padding: 8px 4px;
    }
    .stats b {
        font-size: 15px;
    }
    .stats span {
        font-size: 9.5px;
    }
    .score strong {
        font-size: 48px;
    }
    .panel {
        padding: 16px;
    }
    .authbox {
        padding: 20px 16px;
    }
}