* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #f5f6fa; color: #2d3436; font-size: 14px; }
.container { max-width: 1400px; margin: 0 auto; padding: 24px 16px; }
h1 { font-size: 22px; margin-bottom: 20px; color: #1F4E79; }
.back { margin-bottom: 12px; }
.back a { color: #1F4E79; text-decoration: none; font-size: 13px; }
.back a:hover { text-decoration: underline; }

/* Заголовок страницы */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.page-header h1 { margin-bottom: 0; }

/* Кнопка добавления */
.btn-add { background: #1F4E79; color: #fff; border: none; border-radius: 8px; padding: 10px 20px; font-size: 14px; font-weight: 600; cursor: pointer; transition: background .2s; }
.btn-add:hover { background: #2a6099; }
.btn-settings { background: #f0f0f0; color: #555; border: none; border-radius: 8px; padding: 10px 16px; font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: none; transition: background .2s; }
.btn-settings:hover { background: #e0e0e0; }

/* Форма добавления */
.add-form-wrap { background: #fff; border: 2px solid #1F4E79; border-radius: 12px; padding: 24px; margin-bottom: 24px; }
.add-form-title { font-size: 16px; font-weight: 700; color: #1F4E79; margin-bottom: 16px; }
.add-form-row { margin-bottom: 14px; }
.add-form-row label { display: block; font-size: 13px; color: #555; margin-bottom: 5px; font-weight: 500; }
.add-form-row input { width: 100%; padding: 10px 14px; border: 1px solid #ddd; border-radius: 8px; font-size: 14px; outline: none; transition: border-color .2s; }
.add-form-row input:focus { border-color: #1F4E79; }
.add-form-hint { font-size: 12px; color: #888; margin-bottom: 16px; line-height: 1.5; }
.add-form-actions { display: flex; gap: 10px; }
.btn-submit { background: #1F4E79; color: #fff; border: none; border-radius: 8px; padding: 10px 24px; font-size: 14px; font-weight: 600; cursor: pointer; }
.btn-submit:hover { background: #2a6099; }
.btn-cancel { background: #f0f0f0; color: #555; border: none; border-radius: 8px; padding: 10px 20px; font-size: 14px; cursor: pointer; }
.btn-cancel:hover { background: #e0e0e0; }

/* Уведомление о работающем парсере */
.running-notice { background: #fff8e1; border: 1px solid #ffc107; border-radius: 8px; padding: 12px 16px; margin-bottom: 20px; font-size: 13px; color: #856404; }

/* Карточки поисков */
.search-grid { display: flex; flex-wrap: wrap; gap: 16px; }
.search-card-wrap { position: relative; display: inline-block; }
.search-card { display: block; background: #fff; border-radius: 10px; padding: 20px 24px; text-decoration: none; color: inherit; border: 2px solid #e0e0e0; min-width: 200px; transition: border-color .2s, box-shadow .2s; }
.search-card:hover { border-color: #1F4E79; box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.search-name { font-size: 16px; font-weight: 600; color: #1F4E79; }
.search-date { font-size: 12px; color: #888; margin-top: 4px; }
.empty { color: #888; }
.delete-form { position: absolute; top: 6px; right: 8px; }
.btn-delete { background: none; border: none; color: #ccc; font-size: 18px; cursor: pointer; padding: 2px 6px; line-height: 1; border-radius: 4px; }
.btn-delete:hover { color: #d63031; background: #fff0f0; }

/* Кнопка отправки и шапка страницы поиска */
.search-page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.btn-send { background: #1F4E79; color: #fff; border: none; border-radius: 8px; padding: 9px 18px; font-size: 14px; font-weight: 600; cursor: pointer; transition: background .2s; }
.btn-send:hover { background: #2a6099; }

/* Модальное окно */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-box { background: #fff; border-radius: 14px; padding: 28px 32px; width: 360px; max-width: 95vw; box-shadow: 0 8px 32px rgba(0,0,0,.2); }
.modal-title { font-size: 18px; font-weight: 700; color: #1F4E79; margin-bottom: 6px; }
.modal-desc { font-size: 13px; color: #636e72; margin-bottom: 18px; }
.modal-channels { display: flex; gap: 20px; margin-bottom: 18px; }
.channel-opt { display: flex; align-items: center; gap: 7px; font-size: 15px; cursor: pointer; font-weight: 500; }
.channel-opt input { width: 18px; height: 18px; cursor: pointer; }
.modal-status { min-height: 20px; font-size: 13px; margin-bottom: 14px; font-weight: 500; }
.modal-status.ok { color: #00b894; }
.modal-status.error { color: #d63031; }
.modal-actions { display: flex; gap: 10px; margin-bottom: 14px; }
.modal-settings-link { font-size: 12px; text-align: center; }
.modal-settings-link a { color: #636e72; text-decoration: none; }
.modal-settings-link a:hover { text-decoration: underline; }

/* Страница настроек */
.settings-form { max-width: 600px; }
.settings-section { background: #fff; border-radius: 12px; padding: 22px 24px; margin-bottom: 20px; border: 1px solid #e0e0e0; }
.settings-section-title { font-size: 16px; font-weight: 700; color: #1F4E79; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.badge-ok { background: #d4f8e8; color: #00b894; font-size: 12px; padding: 2px 10px; border-radius: 12px; font-weight: 600; }
.badge-off { background: #f0f0f0; color: #aaa; font-size: 12px; padding: 2px 10px; border-radius: 12px; font-weight: 600; }
.settings-hint { background: #f8f9fa; border-left: 3px solid #1F4E79; border-radius: 4px; padding: 12px 14px; margin-bottom: 16px; font-size: 12px; color: #555; line-height: 1.7; }
.settings-hint a { color: #1F4E79; }
.settings-hint code { background: #e8f0f8; padding: 1px 5px; border-radius: 3px; font-size: 11px; }
.settings-row { margin-bottom: 14px; }
.settings-row label { display: block; font-size: 13px; color: #555; margin-bottom: 5px; font-weight: 500; }
.settings-row input[type="text"],
.settings-row input[type="email"],
.settings-row input[type="password"] { width: 100%; padding: 10px 14px; border: 1px solid #ddd; border-radius: 8px; font-size: 14px; outline: none; transition: border-color .2s; }
.settings-row input:focus { border-color: #1F4E79; }
.settings-sub { font-size: 11px; color: #aaa; margin-top: 4px; }
.settings-row-hidden { display: none; }
.alert-ok { background: #d4f8e8; color: #00b894; border-radius: 8px; padding: 12px 16px; margin-bottom: 20px; font-weight: 600; }

/* Статистика */
.stats-bar { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.stat { background: #fff; border-radius: 8px; padding: 12px 18px; text-align: center; border: 1px solid #e0e0e0; min-width: 100px; }
.stat-num { display: block; font-size: 20px; font-weight: 700; color: #1F4E79; }
.stat-label { display: block; font-size: 11px; color: #888; margin-top: 2px; }
.stat.new .stat-num { color: #0984e3; }
.stat.removed .stat-num { color: #636e72; }
.stat.up .stat-num { color: #d63031; }
.stat.down .stat-num { color: #00b894; }
.stat.avg .stat-num { font-size: 15px; }

.date-info { font-size: 13px; color: #636e72; margin-bottom: 14px; }

/* Таблица */
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
thead tr { background: #1F4E79; color: #fff; }
th { padding: 10px 12px; text-align: left; font-size: 13px; font-weight: 600; }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { background: #2a6099; }
.sort-icon { opacity: .6; font-size: 11px; margin-left: 2px; }
td { padding: 9px 12px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f9f9f9; }

.td-center { text-align: center; }
.td-right { text-align: right; }
.td-link a { color: #1F4E79; text-decoration: none; font-weight: 500; }
.td-link a:hover { text-decoration: underline; }

/* Цвета строк */
.row-new { background: #e8f4fd !important; }
.row-up { background: #fff5f5 !important; }
.row-down { background: #f0fff4 !important; }
.row-removed { background: #f7f7f7 !important; opacity: .7; }
.removed-header { background: #636e72; color: #fff; font-weight: 600; text-align: center; padding: 8px; }

/* Бейджи */
.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.badge-new { background: #d4eeff; color: #0984e3; }
.badge-up { background: #ffe5e5; color: #d63031; }
.badge-down { background: #d4f8e8; color: #00b894; }
.badge-same { background: #f0f0f0; color: #aaa; }
.badge-removed { background: #e0e0e0; color: #636e72; }
