/* Рейтинг сайтов — оформление (вынесено из index.tpl) */
* { box-sizing: border-box; }
    body {
        margin: 0;
        padding: 0;
        font-family: -apple-system, "Segoe UI", Arial, Tahoma, sans-serif;
        background: #f2f4f7;
        color: #1c2733;
        font-size: 14px;
        line-height: 1.45;
    }
    a { color: #1a63e6; text-decoration: none; }
    a:hover { text-decoration: underline; }
    .rt-wrapper { min-width: 320px; }

    /* ===== Шапка ===== */
    .rt-header {
        background: #ffffff;
        border-bottom: 1px solid #e3e7ee;
    }
    .rt-header-inner {
        max-width: 1180px;
        margin: 0 auto;
        padding: 14px 20px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 10px;
    }
    .rt-logo {
        font-size: 22px;
        font-weight: 800;
        color: #16213a;
        letter-spacing: -0.3px;
    }
    .rt-logo:hover { text-decoration: none; color: #1a63e6; }
    .rt-btn-add {
        background: #1a63e6;
        color: #fff !important;
        padding: 9px 18px;
        border-radius: 8px;
        font-weight: 600;
        font-size: 13px;
        transition: background .15s;
    }
    .rt-btn-add:hover { background: #0f4bc0; text-decoration: none; }

    /* ===== Табы навигации ===== */
    .rt-tabs { background: #ffffff; border-bottom: 1px solid #e3e7ee; }
    .rt-tabs-inner {
        max-width: 1180px;
        margin: 0 auto;
        padding: 0 20px;
        display: flex;
        gap: 6px;
    }
    .rt-tab {
        display: inline-block;
        padding: 12px 16px;
        color: #5b6472;
        font-weight: 600;
        font-size: 13px;
        border-bottom: 3px solid transparent;
        margin-bottom: -1px;
    }
    .rt-tab:hover { color: #1a63e6; text-decoration: none; }
    .rt-tab.active { color: #16213a; border-bottom-color: #1a63e6; }

    /* ===== Полоса статистики ===== */
    .rt-statsbar {
        background: linear-gradient(90deg,#1a63e6,#3f7ff0);
    }
    .rt-statsbar-inner {
        max-width: 1180px;
        margin: 0 auto;
        padding: 12px 20px;
        color: #fff;
    }
    .rt-statsbar .topstat { color: #fff; }
    .rt-statsbar .topstat p { display: inline-block; margin: 0 22px 0 0; font-size: 13px; opacity: .95; }
    .rt-statsbar .topstat p strong { display: none; }
    .rt-statsbar .topstat .hits,
    .rt-statsbar .topstat .hosts,
    .rt-statsbar .topstat .sites { font-weight: 700; color: #fff; }

    /* ===== Анонс/новостная полоса (опционально, скрывается если пусто) ===== */
    .rt-news:empty { display: none; }
    .rt-news {
        max-width: 1180px;
        margin: 12px auto 0;
        padding: 10px 16px;
        background: #fff7e0;
        border: 1px solid #ffe4a6;
        border-radius: 8px;
        font-size: 13px;
    }

    /* ===== Общая сетка ===== */
    .rt-body {
        max-width: 1180px;
        margin: 20px auto;
        padding: 0 20px;
        display: flex;
        gap: 20px;
        align-items: flex-start;
    }
    .rt-sidebar { width: 280px; flex: 0 0 280px; }
    .rt-main { flex: 1 1 auto; min-width: 0; }

    /* ===== Карточка (общий стиль виджетов) ===== */
    .rt-card {
        background: #fff;
        border: 1px solid #e3e7ee;
        border-radius: 10px;
        padding: 16px 18px;
        margin-bottom: 16px;
    }
    .widget-title {
        font-size: 14px;
        font-weight: 700;
        color: #16213a;
        margin: 0 0 12px;
        padding-bottom: 8px;
        border-bottom: 1px solid #eef1f5;
    }

    /* ===== Виджет категорий (catalog1.php -> catalog.tpl/catalog_list.tpl) ===== */
    .categories-widget, .bar-graph-widget { background: #fff; border: 1px solid #e3e7ee; border-radius: 10px; padding: 14px 16px; margin-bottom: 16px; }
    .categories-list { display: flex; flex-direction: column; }
    .category-item { padding: 7px 0; border-bottom: 1px solid #f1f3f7; }
    .category-item:last-child { border-bottom: none; }
    .category-name a { font-weight: 600; color: #16213a; font-size: 13px; }
    .category-name a:hover { color: #1a63e6; }
    .category-subcats { margin-top: 4px; font-size: 12px; color: #8b93a1; }
    .category-subcats a { color: #6b7684; margin-right: 6px; }
    .category-subcats a:hover { color: #1a63e6; }
    .cat-sep { display: block; height: 1px; background: #eef1f5; margin: 6px 0; }
    .bar-graph-widget table { font-size: 11px; }

    /* ===== Каталог всех категорий (?action=catalogs) ===== */
    .all-categories-page { background: #fff; border: 1px solid #e3e7ee; border-radius: 10px; padding: 18px 20px; }
    .all-categories-page .page-title { font-size: 18px; margin: 0 0 14px; color: #16213a; }
    .all-categories-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 24px; }
    .category-block-full { padding-bottom: 10px; }
    .category-name-full a { font-weight: 700; color: #16213a; }
    .category-subcats-full { list-style: none; margin: 6px 0 0; padding: 0; font-size: 12px; }
    .category-subcats-full li { padding: 2px 0; }
    .category-subcats-full a { color: #6b7684; }
    .category-subcats-full a:hover { color: #1a63e6; }
    .cat-sep-full { display: block; grid-column: 1 / -1; height: 1px; background: #eef1f5; }

    /* ===== Заголовок основной колонки ===== */
    .rt-main-head {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 14px;
    }
    .rt-title { font-size: 20px; font-weight: 800; color: #16213a; margin: 0; }
    .rt-where { font-size: 12px; color: #8b93a1; }

    /* ===== Таблица рейтинга (listrating_category() из bootstrap.php) ===== */
    .rating-table-wrap { background: #fff; border: 1px solid #e3e7ee; border-radius: 10px; overflow: hidden; }
    table.rating-table { width: 100%; border-collapse: collapse; font-size: 13px; }
    table.rating-table thead th {
        background: #f7f9fc;
        color: #8b93a1;
        font-weight: 600;
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: .03em;
        text-align: left;
        padding: 10px 14px;
        border-bottom: 1px solid #e3e7ee;
    }
    table.rating-table th.col-pos, table.rating-table td.col-pos { width: 46px; text-align: center; }
    table.rating-table th.col-rank, table.rating-table td.col-rank,
    table.rating-table th.col-hits, table.rating-table td.col-hits { width: 100px; text-align: right; }
    table.rating-table th.col-action, table.rating-table td.col-action { width: 90px; text-align: right; }
    table.rating-table tbody tr { border-bottom: 1px solid #eef1f5; }
    table.rating-table tbody tr:hover { background: #f7faff; }
    table.rating-table tbody tr:last-child { border-bottom: none; }
    table.rating-table td { padding: 12px 14px; vertical-align: middle; }
    .pos-badge {
        display: inline-flex; align-items: center; justify-content: center;
        width: 26px; height: 26px; border-radius: 50%;
        background: #eef1f5; color: #5b6472; font-weight: 700; font-size: 12px;
    }
    tbody tr:nth-child(1) .pos-badge { background: #ffd54a; color: #6b4c00; }
    tbody tr:nth-child(2) .pos-badge { background: #d9dee6; color: #45505f; }
    tbody tr:nth-child(3) .pos-badge { background: #f0c39a; color: #6b3d00; }
    .site-link { font-weight: 700; color: #16213a; display: block; }
    .site-link:hover { color: #1a63e6; }
    .site-url { display: block; font-size: 11px; color: #9aa2ae; margin-top: 2px; }
    .cat-tag {
        display: inline-block; background: #eaf1ff; color: #1a63e6;
        font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px;
    }
    td.col-rank, td.col-hits { font-weight: 700; color: #16213a; }
    td.col-action a { font-size: 12px; color: #8b93a1; }
    td.col-action a:hover { color: #1a63e6; }
    .empty-msg { padding: 30px; text-align: center; color: #8b93a1; }

    /* ===== Топ сайтов / каталог сайтов внутри категории (alltop.tpl, allcat.tpl) ===== */
    .all-top, .all-catalog, .cat-top {
        background: #fff; border: 1px solid #e3e7ee; border-radius: 10px; padding: 4px;
    }
    .all-top > p, .all-catalog > p, .cat-top > p {
        margin: 0; padding: 10px 14px; font-size: 12px; color: #8b93a1;
        border-bottom: 1px solid #eef1f5;
    }

    /* ===== Пагинация ===== */
    .rt-pagination { margin-top: 16px; text-align: center; }
    .rt-pagination a, .rt-pagination span {
        display: inline-flex; align-items: center; justify-content: center;
        min-width: 32px; height: 32px; padding: 0 6px; margin: 0 3px;
        border-radius: 8px; font-size: 13px; font-weight: 600;
        background: #fff; border: 1px solid #e3e7ee; color: #5b6472;
    }
    .rt-pagination a:hover { border-color: #1a63e6; color: #1a63e6; text-decoration: none; }
    .rt-pagination span { background: #1a63e6; border-color: #1a63e6; color: #fff; }

    /* ===== Подвал ===== */
    .rt-footer { background: #16213a; margin-top: 30px; }
    .rt-footer-inner {
        max-width: 1180px; margin: 0 auto; padding: 20px 20px 24px;
        color: #aab3c2; font-size: 12px;
    }
    .rt-footer-inner a { color: #cfd8e6; }
    .rt-cat-exit:empty { display: none; }
    .rt-footer-bottom { display: flex; align-items: center; justify-content: space-between;
                         gap: 16px; margin-top: 10px; flex-wrap: wrap; }
    .rt-copyright { margin: 0; }
    .rt-footer-counters { display: flex; align-items: center; gap: 10px; }
    .rt-footer-counters:empty { display: none; }

    @media (max-width: 860px) {
        .rt-body { flex-direction: column; }
        .rt-sidebar { width: 100%; flex: none; order: 2; }
        .rt-main { order: 1; }
        .all-categories-grid { grid-template-columns: 1fr; }
        table.rating-table .site-url { display: none; }
    }

/* ===== Форма добавления сайта (reg.php / reg_step1.tpl / reg_step2.tpl) ===== */
.reg-page { background:#fff; border:1px solid #e3e7ee; border-radius:10px; padding:22px 26px; max-width:720px; }
.reg-page h2 { margin:0 0 14px; font-size:20px; color:#16213a; }
.reg-rules { font-size:13px; color:#5b6472; margin-bottom:18px; }
.reg-rules ul { margin:8px 0; padding-left:20px; }
.reg-row { margin-bottom:16px; }
.reg-row label { display:block; font-weight:600; font-size:13px; color:#16213a; margin-bottom:5px; }
.reg-row .req { color:#d33; }
.reg-row input[type=text], .reg-row input[type=email], .reg-row input[type=password],
.reg-row select, .reg-row textarea {
    width:100%; padding:9px 11px; border:1px solid #d7dce5; border-radius:8px;
    font:14px/1.4 inherit; background:#fff; color:#1c2733; box-sizing:border-box;
}
.reg-row input:focus, .reg-row select:focus, .reg-row textarea:focus { outline:none; border-color:#1a63e6; }
.reg-row small { display:block; margin-top:4px; font-size:12px; color:#8b93a1; }
.reg-row-2 { display:flex; gap:14px; }
.reg-row-2 > div { flex:1; }
.reg-checks label { font-weight:400; font-size:13px; color:#5b6472; margin-bottom:6px; }
.reg-checks input { margin-right:6px; }
.reg-buttons td { padding:6px 10px 6px 0; vertical-align:middle; }
.reg-submit { background:#1a63e6; color:#fff; border:0; padding:11px 22px; border-radius:8px;
              font-size:14px; font-weight:600; cursor:pointer; }
.reg-submit:hover { background:#0f4bc0; }
.reg-ok  { background:#f2fbf4; border:1px solid #bfe6c9; border-radius:8px; padding:14px 16px; color:#1d6b33; }
.reg-err { background:#fff5f5; border:1px solid #ffd0d0; border-radius:8px; padding:14px 16px; color:#7a1f1f; }
.reg-note { color:#8b93a1; font-size:13px; }

/* ===== Страница статистики сайта (stat.php) ===== */
.stat-page { display:flex; gap:20px; align-items:flex-start; }
.stat-main { flex:1; min-width:0; }
.stat-nav  { width:230px; flex-shrink:0; background:#fff; border:1px solid #e3e7ee;
             border-radius:10px; padding:14px 16px; font-size:13px; }
.stat-nav table { width:100%; border-collapse:collapse; }
.stat-nav a.nav, .stat-nav a { color:#1a63e6; text-decoration:none; }
.stat-nav a.nav:hover, .stat-nav a:hover { text-decoration:underline; }
.stat-nav hr { border:0; border-top:1px solid #eef1f6; margin:8px 0; }

.stat-card { background:#fff; border:1px solid #e3e7ee; border-radius:10px; padding:20px 24px; margin-bottom:18px; }
.stat-card h2 { margin:0 0 6px; font-size:20px; color:#16213a; }
.stat-card-url a { color:#1a63e6; font-size:13px; text-decoration:none; word-break:break-all; }
.stat-card-url a:hover { text-decoration:underline; }
.stat-card-descr { color:#5b6472; font-size:13px; margin:8px 0 16px; }
.stat-card-metrics { display:grid; grid-template-columns:repeat(3,1fr); gap:12px; }
.stat-card-metrics > div { background:#f7f9fc; border-radius:8px; padding:10px 12px; text-align:center; }
.stat-card-metrics .num { display:block; font-size:20px; font-weight:700; color:#16213a; }
.stat-card-metrics .lbl { display:block; font-size:11px; color:#8b93a1; margin-top:2px; }

.stat-section { background:#fff; border:1px solid #e3e7ee; border-radius:10px; padding:18px 20px;
                font-size:13px; color:#333; overflow-x:auto; }
.stat-section table { border-collapse:collapse; }
.stat-section table td, .stat-section table th { padding:4px 8px; }

@media (max-width: 720px) {
    .stat-page { flex-direction:column; }
    .stat-nav { width:100%; order:2; }
    .stat-card-metrics { grid-template-columns:repeat(2,1fr); }
}
.stat-table { width:100%; border-collapse:collapse; margin-top:8px; }
.stat-table th, .stat-table td { padding:6px 10px; border-bottom:1px solid #eef1f6; text-align:left; }
.stat-table th { background:#f7f9fc; font-size:12px; color:#5b6472; }
.stat-comment { padding:8px 0; border-bottom:1px solid #eef1f6; font-size:13px; }

/* ===== Личный кабинет (my_sites.php) ===== */
.my-sites-page { max-width: 760px; }
.my-sites-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:18px; }
.my-sites-header h2 { margin:0; font-size:20px; color:#16213a; }
.my-sites-add { text-decoration:none; padding:8px 16px; font-size:13px; }
.my-sites-empty { background:#fff; border:1px solid #e3e7ee; border-radius:10px; padding:30px; text-align:center; color:#5b6472; }
.my-sites-empty p { margin-bottom:14px; }
.my-sites-group { margin-bottom:22px; }
.my-sites-cat { font-size:14px; color:#5b6472; text-transform:uppercase; letter-spacing:.03em;
                margin:0 0 10px; padding-bottom:6px; border-bottom:1px solid #e3e7ee; }
.my-sites-row { background:#fff; border:1px solid #e3e7ee; border-radius:10px; padding:14px 18px; margin-bottom:10px; }
.my-sites-row-main { display:flex; align-items:baseline; justify-content:space-between; gap:10px; }
.my-sites-name { font-size:15px; font-weight:600; color:#16213a; text-decoration:none; }
.my-sites-name:hover { color:#1a63e6; }
.my-sites-date { font-size:12px; color:#8b93a1; white-space:nowrap; }
.my-sites-url a { font-size:12px; color:#1a63e6; text-decoration:none; word-break:break-all; }
.my-sites-url a:hover { text-decoration:underline; }
.my-sites-meta { display:flex; align-items:center; gap:14px; margin-top:8px; font-size:12px; color:#5b6472; }
.site-status { padding:2px 8px; border-radius:6px; font-size:11px; font-weight:600; }
.status-wait { background:#fff6e0; color:#8a6100; }
.status-off  { background:#fff0f0; color:#a3231f; }
.status-on   { background:#eafaf0; color:#177a3f; }
.my-sites-actions { margin-top:10px; display:flex; gap:14px; }
.my-sites-actions a { font-size:12px; color:#1a63e6; text-decoration:none; }
.my-sites-actions a:hover { text-decoration:underline; }
.my-sites-footer { margin-top:14px; font-size:13px; }
.my-sites-footer a { color:#8b93a1; text-decoration:none; }
.my-sites-footer a:hover { text-decoration:underline; }

/* ===== Код счётчика (code.php) ===== */
.code-preview { padding:16px; background:#f7f9fc; border-radius:8px; text-align:center; margin-bottom:14px; }
.code-box { width:100%; box-sizing:border-box; padding:10px 12px; border:1px solid #d7dce5;
            border-radius:8px; font:12px/1.4 monospace; color:#333; background:#fafbfc; resize:vertical; }

/* ===== Форма поиска на главной (index.php) ===== */
.rt-search { display:flex; gap:8px; margin:0 0 18px; }
.rt-search-input { flex:1; padding:10px 14px; border:1px solid #d7dce5; border-radius:8px;
                    font-size:14px; background:#fff; color:#1c2733; }
.rt-search-input:focus { outline:none; border-color:#1a63e6; }
.rt-search-btn { padding:10px 20px; background:#1a63e6; color:#fff; border:0; border-radius:8px;
                  font-size:14px; font-weight:600; cursor:pointer; white-space:nowrap; }
.rt-search-btn:hover { background:#0f4bc0; }

/* ===== Новости на главной (header.tpl {glav_news} / main/glavnews.php) ===== */
.glav-news { max-width: 1180px; margin: 14px auto 0; padding: 0 20px; }
.glav-news-title { margin: 0 0 8px; font-size: 14px; color: #5b6472; text-transform: uppercase;
                    letter-spacing: .03em; }
.glav-news-item { background: #fff; border: 1px solid #e3e7ee; border-radius: 8px;
                   padding: 10px 14px; margin-bottom: 8px; font-size: 13px; display: flex; gap: 12px; }
.glav-news-date { color: #8b93a1; white-space: nowrap; font-size: 12px; flex-shrink: 0; }
.glav-news-text { color: #1c2733; }

/* ===== Форма и звёзды комментариев (stat/pos.php) ===== */
.stat-comment-stars { color: #f5a623; font-size: 13px; letter-spacing: 1px; }
.stat-comment-form { margin-top: 16px; padding-top: 16px; border-top: 1px solid #eef1f6; }
.stat-comment-form .reg-row { margin-bottom: 12px; }
.stat-comment-form select { width: 100%; padding: 9px 11px; border: 1px solid #d7dce5;
                             border-radius: 8px; font: 14px/1.4 inherit; background: #fff; color: #1c2733; }
