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

body {
    font-family: Arial, sans-serif;
    font-size: 16px;
    color: #202124;
    background: #fff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: #1a0dab; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    border-bottom: 1px solid #e0e0e0;
}
.logo { font-size: 1.4rem; font-weight: 700; color: #1a0dab; }
.site-header nav a { margin-left: 16px; font-size: 0.9rem; color: #5f6368; }

/* Main */
main { flex: 1; padding: 24px; max-width: 800px; margin: 0 auto; width: 100%; }

/* Home hero */
.home-hero { text-align: center; padding: 80px 0 40px; }
.home-title { font-size: 3rem; color: #1a0dab; margin-bottom: 8px; }
.home-subtitle { color: #5f6368; margin-bottom: 32px; }

/* Search form */
.search-form { width: 100%; }
.search-row { display: flex; gap: 8px; }
.search-input {
    flex: 1;
    padding: 12px 16px;
    font-size: 1rem;
    border: 1px solid #dfe1e5;
    border-radius: 24px;
    outline: none;
}
.search-input:focus { border-color: #4285f4; box-shadow: 0 0 0 2px #c2d7f7; }
.search-btn {
    padding: 12px 24px;
    background: #4285f4;
    color: #fff;
    border: none;
    border-radius: 24px;
    font-size: 1rem;
    cursor: pointer;
}
.search-btn:hover { background: #1a73e8; }

/* Search header (compact) */
.search-form--compact .search-input { border-radius: 4px; }
.search-form--compact .search-btn  { border-radius: 4px; }
.search-header { margin-bottom: 16px; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 4px; margin-bottom: 16px; font-size: 0.9rem; }
.alert--warning { background: #fef7e0; border: 1px solid #f4bc42; color: #856404; }

/* Results meta */
.results-meta { color: #5f6368; font-size: 0.85rem; margin-bottom: 16px; }

/* Result list */
.results-list { list-style: none; }
.result-item { margin-bottom: 28px; }
.result-domain { font-size: 0.8rem; color: #3c4043; margin-bottom: 2px; }
.result-title { font-size: 1.1rem; font-weight: normal; margin-bottom: 2px; }
.result-url { font-size: 0.8rem; color: #006621; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-meta-desc { font-size: 0.9rem; color: #3c4043; margin-bottom: 4px; }
.result-snippet { font-size: 0.9rem; color: #4d5156; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.result-snippet mark { background: none; font-weight: bold; color: #000; }

/* Pagination */
.pagination { display: flex; gap: 8px; align-items: center; margin-top: 24px; flex-wrap: wrap; }
.page-link {
    padding: 8px 14px;
    border: 1px solid #dfe1e5;
    border-radius: 4px;
    color: #1a0dab;
    font-size: 0.9rem;
}
.page-link:hover { background: #f8f9fa; text-decoration: none; }
.page-link--current { background: #4285f4; color: #fff; border-color: #4285f4; }

/* Footer */
.site-footer { text-align: center; padding: 16px; border-top: 1px solid #e0e0e0; color: #5f6368; font-size: 0.8rem; }

/* Responsive */
@media (max-width: 600px) {
    main { padding: 16px; }
    .home-hero { padding: 40px 0 24px; }
    .home-title { font-size: 2rem; }
    .search-row { flex-direction: column; }
    .search-btn { width: 100%; }
}

/* ─── Buttons ─── */
.btn {
    padding: 10px 20px;
    background: #4285f4;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    white-space: nowrap;
}
.btn:hover { background: #1a73e8; }

.btn-secondary {
    background: #f8f9fa;
    color: #3c4043;
    border: 1px solid #dadce0;
}
.btn-secondary:hover { background: #e8eaed; }

.btn-small { padding: 6px 12px; font-size: 0.8rem; }

.btn-danger { background: #d93025; }
.btn-danger:hover { background: #b31412; }

.nav-link-btn {
    background: none;
    border: none;
    color: #5f6368;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0;
    margin-left: 16px;
}
.nav-link-btn:hover { text-decoration: underline; }

/* ─── Flash messages ─── */
.flash {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}
.flash-success { background: #e6f4ea; border: 1px solid #34a853; color: #137333; }
.flash-error   { background: #fce8e6; border: 1px solid #ea4335; color: #c5221f; }
.flash-global  { margin: 0; border-radius: 0; }

/* ─── Status badges ─── */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.badge-active  { background: #e6f4ea; color: #137333; }
.badge-pending { background: #fef7e0; color: #856404; }
.badge-paused  { background: #e8eaed; color: #3c4043; }
.badge-dead    { background: #fce8e6; color: #c5221f; }

/* ─── Table ─── */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.data-table th {
    text-align: left;
    padding: 8px 12px;
    border-bottom: 2px solid #e0e0e0;
    color: #5f6368;
    font-weight: 600;
}
.data-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f8f9fa; }

/* ─── Shared form helpers ─── */
.field-row { display: flex; gap: 8px; align-items: center; }
.field-row input[type="text"],
.field-row input[type="password"] {
    flex: 1;
    padding: 10px 14px;
    font-size: 0.95rem;
    border: 1px solid #dfe1e5;
    border-radius: 4px;
}
.field-row input[type="text"]:focus,
.field-row input[type="password"]:focus {
    border-color: #4285f4;
    outline: none;
    box-shadow: 0 0 0 2px #c2d7f7;
}

.empty-state { color: #5f6368; font-size: 0.9rem; padding: 16px 0; }

/* ─── Admin layout ─── */
main.admin-main { max-width: 1100px; }
main.log-main { max-width: none; }
.log-output { white-space: pre-wrap; word-break: break-all; overflow-wrap: break-word; width: 100%; }

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e0e0e0;
}
.admin-header h1 { font-size: 1.4rem; color: #202124; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}
.stat-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-left: 4px solid #4285f4;
    border-radius: 4px;
    padding: 16px;
}
.stat-card h3 {
    font-size: 0.75rem;
    color: #5f6368;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}
.stat-number { font-size: 2rem; font-weight: 700; color: #202124; line-height: 1; }
.stat-card > div { font-size: 0.85rem; color: #3c4043; line-height: 1.8; }

.admin-section {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 20px 24px;
    margin-bottom: 20px;
}
.admin-section h2 {
    font-size: 1rem;
    color: #202124;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: 0.8rem; color: #5f6368; font-weight: 500; }
.form-group input[type="text"],
.form-group input[type="number"],
.form-group select {
    padding: 8px 10px;
    font-size: 0.9rem;
    border: 1px solid #dfe1e5;
    border-radius: 4px;
}
.form-group input:focus,
.form-group select:focus {
    border-color: #4285f4;
    outline: none;
    box-shadow: 0 0 0 2px #c2d7f7;
}

.admin-form-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr auto auto;
    gap: 8px;
    align-items: end;
}
.form-group-check {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
    padding-bottom: 2px;
}
.form-group-check label { font-size: 0.8rem; color: #5f6368; font-weight: 500; }
.form-group-check input[type="checkbox"] { width: 16px; height: 16px; margin-top: 2px; }

@media (max-width: 900px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .admin-form-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
    .stats-grid { grid-template-columns: 1fr; }
    .admin-form-grid { grid-template-columns: 1fr; }
}

/* ─── Status icon buttons ─── */
.btn-status {
    padding: 4px 7px;
    border: 1px solid #dadce0;
    border-radius: 3px;
    background: #f8f9fa;
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1;
}
.btn-status:hover { background: #e8eaed; }
.btn-status-current {
    padding: 4px 7px;
    border: 1px solid #b0b8c1;
    border-radius: 3px;
    background: #e8eaed;
    cursor: default;
    font-size: 0.85rem;
    line-height: 1;
    font-weight: 700;
}

/* ─── Progress bar ─── */
.progress-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 110px;
}
.progress-track {
    flex: 1;
    height: 7px;
    background: #e8eaed;
    border-radius: 4px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: #1a73e8;
    border-radius: 4px;
    transition: width 0.5s ease;
    min-width: 0;
}
.progress-fill.done { background: #137333; }
.progress-pct {
    font-size: 0.72rem;
    color: #5f6368;
    min-width: 30px;
    text-align: right;
    white-space: nowrap;
}

/* Autocomplete dropdown */
.search-autocomplete { position: relative; }
.suggest-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    background: #fff;
    border: 1px solid #dfe1e5;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
    overflow: hidden;
}
.suggest-item {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 1rem;
    color: #202124;
    text-align: left;
}
.suggest-item:hover,
.suggest-item.active { background: #f1f3f4; }
.suggest-item--exact { font-weight: 600; }
