:root {
    --bg: #f3f6fb;
    --bg-soft: #f8fafc;
    --card: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --danger-bg: #fef2f2;
    --danger-text: #b91c1c;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 10px 30px rgba(15, 23, 42, 0.06);
    --radius: 16px;
    --radius-sm: 12px;
    --max-width: 1120px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background:
        radial-gradient(circle at top left, #eef4ff 0, transparent 35%),
        linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
    color: var(--text);
    line-height: 1.55;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.container {
    width: min(var(--max-width), calc(100% - 32px));
    margin: 32px auto 48px;
}

.site-header,
.site-footer,
.card {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}

.site-header {
    padding: 28px;
    margin-bottom: 22px;
}

.site-header h1 {
    margin: 0 0 8px;
    font-size: clamp(1.6rem, 2vw, 2.1rem);
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.site-header p {
    margin: 0;
    color: var(--muted);
    max-width: 70ch;
}

.site-header a {
    color: var(--text);
    text-decoration: none;
}

.site-footer {
    margin-top: 24px;
    padding: 18px 22px;
    color: var(--muted);
    font-size: 0.95rem;
}

.card {
    padding: 24px;
    margin-bottom: 22px;
}

.card h2 {
    margin: 0 0 14px;
    font-size: 1.35rem;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.card h3 {
    margin: 0 0 10px;
    font-size: 1.08rem;
    line-height: 1.35;
}

.card p {
    margin-top: 0;
}

.search-form {
    margin-top: 10px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.93rem;
    font-weight: 600;
    color: #334155;
}

input,
select,
textarea,
button {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    color: var(--text);
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

input::placeholder,
textarea::placeholder {
    color: #94a3b8;
}

input:hover,
select:hover,
textarea:hover {
    border-color: var(--border-strong);
}

input:focus,
select:focus,
textarea:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 18px;
}

button,
.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 11px 18px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(180deg, #3b82f6 0%, var(--primary) 100%);
    color: #fff;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.2);
    transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
    text-decoration: none;
}

button:hover,
.button-link:hover {
    transform: translateY(-1px);
    background: linear-gradient(180deg, #2563eb 0%, var(--primary-hover) 100%);
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.24);
    text-decoration: none;
}

button:active,
.button-link:active {
    transform: translateY(0);
}

.results-list {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

.result-item {
    padding: 18px 18px 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
    box-shadow: var(--shadow-sm);
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.result-item:hover {
    transform: translateY(-2px);
    border-color: #bfdbfe;
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.08);
}

.result-item h3 {
    margin-bottom: 12px;
}

.result-item h3 a {
    color: var(--text);
    text-decoration: none;
}

.result-item h3 a:hover {
    color: var(--primary);
}

ul {
    margin: 0;
    padding-left: 18px;
}

.result-item ul,
.card > ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.result-item li,
.card > ul li {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 7px 0;
    border-top: 1px solid #f1f5f9;
    color: #334155;
}

.result-item li:first-child,
.card > ul li:first-child {
    border-top: 0;
    padding-top: 0;
}

.result-item strong,
.card > ul strong {
    color: var(--text);
    min-width: 170px;
}

.alert {
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}

.alert.error {
    background: var(--danger-bg);
    color: var(--danger-text);
    border-color: #fecaca;
}

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.pagination span {
    color: var(--muted);
    font-weight: 600;
}

.pagination a {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 9px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    text-decoration: none;
    transition: border-color 0.16s ease, background-color 0.16s ease, transform 0.16s ease;
}

.pagination a:hover {
    border-color: #93c5fd;
    background: #f8fbff;
    transform: translateY(-1px);
}

code,
pre {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (max-width: 720px) {
    .container {
        width: min(var(--max-width), calc(100% - 20px));
        margin: 20px auto 32px;
    }

    .site-header,
    .card,
    .site-footer {
        padding: 18px;
        border-radius: 14px;
    }

    .result-item {
        padding: 15px;
    }

    .result-item strong,
    .card > ul strong {
        min-width: 100%;
    }

    .pagination {
        flex-direction: column;
        align-items: stretch;
    }

    .pagination a,
    button,
    .button-link {
        width: 100%;
    }
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
}

.button-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 11px 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    color: var(--text);
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.16s ease, border-color 0.16s ease, background-color 0.16s ease;
}

.button-secondary:hover {
    border-color: #93c5fd;
    background: #f8fbff;
    transform: translateY(-1px);
    text-decoration: none;
}

@media (max-width: 720px) {
    .page-actions {
        flex-direction: column;
    }

    .button-secondary,
    .page-actions .button-link {
        width: 100%;
    }
}

.result-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 14px;
}

.result-title-wrap {
    flex: 1;
    min-width: 0;
}

.result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.button-small {
    min-height: 38px;
    padding: 9px 12px;
    font-size: 0.92rem;
    border-radius: 10px;
    white-space: nowrap;
}

.muted-note {
    color: var(--muted);
    margin: 6px 0 16px;
}

@media (max-width: 820px) {
    .result-top {
        flex-direction: column;
        align-items: stretch;
    }

    .result-actions {
        justify-content: stretch;
    }

    .result-actions a {
        width: 100%;
    }
}

.toolbar-form {
    margin: 12px 0 18px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fbfdff;
}

.toolbar-row {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 16px;
    flex-wrap: wrap;
}

.toolbar-field {
    min-width: 240px;
}

.toolbar-field select {
    width: 100%;
}

.toolbar-info {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 600;
    border: 1px solid transparent;
}

.chip-danger {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fecaca;
}

.chip-price-low {
    background: #ecfdf5;
    color: #15803d;
    border-color: #bbf7d0;
}

.chip-price-medium {
    background: #fffbeb;
    color: #b45309;
    border-color: #fde68a;
}

.chip-price-high {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #bfdbfe;
}

.deadline-expired,
.deadline-soon {
    color: #b91c1c !important;
    font-weight: 700;
}

.deadline-warning {
    color: #b45309 !important;
    font-weight: 700;
}

.deadline-normal {
    color: #15803d !important;
    font-weight: 600;
}

.price-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 700;
    border: 1px solid transparent;
}

.price-badge.price-low {
    color: #15803d !important;
    background: #ecfdf5;
    border-color: #bbf7d0;
}

.price-badge.price-medium {
    color: #b45309 !important;
    background: #fffbeb;
    border-color: #fde68a;
}

.price-badge.price-high {
    color: #1d4ed8 !important;
    background: #eff6ff;
    border-color: #bfdbfe;
}

.toolbar-field {
    flex: 0 0 190px;
    min-width: 190px;
    max-width: 190px;
}

.toolbar-field select {
    width: 100%;
}

.toolbar-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: nowrap;
}

.toolbar-info {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1 1 auto;
}

.toolbar-row {
    display: flex !important;
    justify-content: space-between;
    align-items: center !important;
    gap: 12px;
    flex-wrap: nowrap !important;
}

.toolbar-field,
.toolbar-field-compact {
    flex: 0 0 165px !important;
    min-width: 165px !important;
    max-width: 165px !important;
}

.toolbar-field label,
.toolbar-field-compact label {
    margin-bottom: 4px;
    font-size: 0.85rem;
}

.toolbar-field select,
.toolbar-field-compact select {
    width: 100%;
    padding: 9px 11px;
    height: 40px;
}

.toolbar-info {
    display: flex !important;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1 1 auto;
}

.deadline-expired,
.deadline-soon {
    color: #dc2626 !important;
    font-weight: 800 !important;
}

.deadline-warning {
    color: #d97706 !important;
    font-weight: 800 !important;
}

.deadline-normal {
    color: #15803d !important;
    font-weight: 700 !important;
}

.price-badge {
    display: inline-flex !important;
    align-items: center;
    padding: 5px 10px;
    border-radius: 999px;
    font-weight: 800 !important;
    line-height: 1;
    border: 1px solid transparent;
}

.price-badge.price-low {
    color: #15803d !important;
    background: #dcfce7 !important;
    border-color: #86efac !important;
}

.price-badge.price-medium {
    color: #b45309 !important;
    background: #fef3c7 !important;
    border-color: #fcd34d !important;
}

.price-badge.price-high {
    color: #1d4ed8 !important;
    background: #dbeafe !important;
    border-color: #93c5fd !important;
}

@media (max-width: 820px) {
    .toolbar-row {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .toolbar-field,
    .toolbar-field-compact {
        min-width: 100% !important;
        max-width: 100% !important;
        flex: 1 1 100% !important;
    }
}