/* Zwiad Przetargów: clean and trustworthy. Tokens and rules follow DIRECTION.md. */

:root {
    --bg: #f7f8fa;
    --surface: #ffffff;
    --line: #e3e7ee;
    --ink: #13233f;
    --text: #3d4a5f;
    --muted: #5b6678;
    --accent: #0e7a5a;
    --accent-ink: #ffffff;
    --accent-soft: #e6f3ee;
    --shadow: 0 1px 2px rgb(19 35 63 / .05), 0 8px 24px rgb(19 35 63 / .06);
    --radius-sm: 8px;
    --radius: 12px;
    --font: "Geist Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "Geist Mono", ui-monospace, "Cascadia Mono", monospace;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0d1522;
        --surface: #131d2d;
        --line: #233046;
        --ink: #e8edf5;
        --text: #c3cbd8;
        --muted: #8d98aa;
        --accent: #3fbf91;
        --accent-ink: #0d1522;
        --accent-soft: #15302a;
        --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px rgb(0 0 0 / .25);
        color-scheme: dark;
    }
}

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 400 15px/1.55 var(--font);
    -webkit-font-smoothing: antialiased;
}

/* Hero Section */
.hero { background: linear-gradient(135deg, var(--ink) 0%, #1a3a5c 100%); color: var(--accent-ink); padding: 64px 0; }
.hero .wrap { max-width: 960px; }
.hero-content { text-align: center; }
.hero h1 { color: var(--accent-ink); font-size: 40px; font-weight: 700; margin: 0 0 16px; }
.hero-subtitle { font-size: 18px; opacity: 0.9; margin: 0 0 32px; max-width: 600px; margin-left: auto; margin-right: auto; }
.hero-stats { display: flex; justify-content: center; gap: 48px; margin: 32px 0; }
.stat { text-align: center; }
.stat-value { display: block; font-size: 32px; font-weight: 700; font-family: var(--mono); color: var(--accent); }
.stat-label { display: block; font-size: 13px; color: rgba(255,255,255,0.7); text-transform: uppercase; letter-spacing: 0.05em; }
.hero-actions { display: flex; justify-content: center; gap: 16px; }
.hero-actions .btn { height: 48px; padding: 0 24px; font-size: 16px; }
.btn-secondary { background: transparent; border: 1px solid rgba(255,255,255,0.3); color: var(--accent-ink); }
.btn-secondary:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.5); }

a { color: inherit; }
h1, h2, h3 { color: var(--ink); font-weight: 600; letter-spacing: -0.015em; margin: 0; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* Header */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: 16px; }
.brand-mark {
    display: grid; place-items: center; width: 32px; height: 32px;
    border-radius: var(--radius-sm); background: var(--ink); color: var(--bg); font-size: 18px;
}
.nav { display: flex; gap: 24px; font-size: 14px; }
.nav a { text-decoration: none; color: var(--muted); transition: color .15s ease-out; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); }

/* Page */
.page { padding: 40px 0 64px; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 28px; }
.page-head .count { font-family: var(--mono); font-size: 13px; color: var(--muted); }

/* Search */
.search {
    display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 16px; box-shadow: var(--shadow); margin-bottom: 32px;
}
.field { display: grid; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink); }
.input-icon { position: relative; }
.input-icon i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 18px; pointer-events: none; }
.input {
    width: 100%; height: 44px; padding: 0 12px 0 40px;
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--bg); color: var(--ink); font: inherit;
    transition: border-color .15s ease-out, box-shadow .15s ease-out;
}
.input::placeholder { color: var(--muted); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.btn {
    display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 20px;
    border: 0; border-radius: var(--radius-sm); background: var(--accent); color: var(--accent-ink);
    font: 600 15px var(--font); cursor: pointer; white-space: nowrap; text-decoration: none;
    transition: transform .15s ease-out, filter .15s ease-out;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.97); }
.btn:focus-visible, .nav a:focus-visible, .tender-title:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Tender list: hairline rows, no card per row */
.tenders { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.tender {
    display: grid; grid-template-columns: 1fr 180px; gap: 8px 32px;
    padding: 18px 20px; border-top: 1px solid var(--line);
}
.tender:first-child { border-top: 0; }
.tender-title { color: var(--ink); font-weight: 600; font-size: 16px; text-decoration: none; line-height: 1.4; }
.tender-title:hover { color: var(--accent); }
.tender-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin-top: 6px; font-size: 14px; color: var(--muted); }
.tender-meta span { display: inline-flex; align-items: center; gap: 6px; }
.tag {
    font-size: 12px; font-weight: 600; color: var(--ink);
    background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 1px 10px;
}
.deadline { text-align: right; }
.deadline-date { font-family: var(--mono); font-size: 14px; color: var(--ink); }
.deadline-left { font-size: 13px; color: var(--muted); }
.deadline.soon .deadline-left { color: var(--ink); font-weight: 600; }
.deadline.closed .deadline-date, .deadline.closed .deadline-left { color: var(--muted); text-decoration: line-through; }

/* States */
.state {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 48px 24px; text-align: center;
}
.state i { font-size: 32px; color: var(--muted); }
.state h2 { font-size: 18px; margin: 12px 0 6px; }
.state p { margin: 0 auto; max-width: 46ch; color: var(--muted); }

.footnote { margin-top: 16px; font-size: 13px; color: var(--muted); }

/* Legal Search Pages */
.legal-search { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 24px; }
.legal-search .search-main { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end; margin-bottom: 16px; }
.legal-search .search-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.legal-search .filter-group { display: grid; gap: 6px; }
.legal-search .filter-group label { font-size: 13px; font-weight: 600; color: var(--ink); }
.legal-search .select { height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); color: var(--ink); font: inherit; }
.legal-search .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.judgment-list { list-style: none; margin: 0; padding: 0; }
.judgment { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 12px; }
.judgment-header { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 12px; }
.judgment-signature { font-family: var(--mono); font-size: 14px; font-weight: 600; color: var(--accent); text-decoration: none; }
.judgment-signature:hover { text-decoration: underline; }
.judgment-type { font-size: 12px; }
.judgment-date { font-size: 13px; color: var(--muted); }
.judgment-title { margin: 0 0 12px; font-size: 18px; }
.judgment-title a { color: var(--ink); text-decoration: none; font-weight: 600; }
.judgment-title a:hover { color: var(--accent); }
.judgment-summary { margin: 0; font-size: 15px; color: var(--text); line-height: 1.6; }
.judgment-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.judgment-court { font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.btn-sm { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 16px; border: 0; border-radius: var(--radius-sm); background: var(--bg); color: var(--ink); font: 600 14px var(--font); cursor: pointer; text-decoration: none; transition: background .15s ease-out; }
.btn-sm:hover { background: var(--line); }
.btn-secondary { background: var(--bg); color: var(--ink); border: 1px solid var(--line); }
.btn-secondary:hover { background: var(--line); }

.pagination { display: flex; justify-content: center; align-items: center; gap: 16px; margin-top: 32px; }
.pagination-info { font-size: 13px; color: var(--muted); }
.pagination-btn { height: 40px; width: 40px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }

/* Case Detail Page */
.case-layout { display: grid; grid-template-columns: 1fr 320px; gap: 24px; }
.case-main { display: grid; gap: 24px; }
.case-sidebar { display: grid; gap: 20px; }

.case-header { border-bottom: 1px solid var(--line); padding-bottom: 20px; }
.case-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-bottom: 16px; font-size: 14px; color: var(--muted); }
.case-type { font-size: 12px; background: var(--accent-soft); color: var(--accent); padding: 2px 8px; border-radius: 4px; }
.case-date, .case-court { display: flex; align-items: center; gap: 6px; }
.case-title { margin: 0 0 16px; font-size: 24px; font-weight: 600; color: var(--ink); }
.case-actions { display: flex; gap: 12px; }

.case-section { border-bottom: 1px solid var(--line); padding-bottom: 20px; }
.case-section:last-child { border-bottom: 0; padding-bottom: 0; }
.case-section h3 { margin: 0 0 16px; font-size: 18px; color: var(--ink); }
.case-summary { font-size: 16px; line-height: 1.7; color: var(--text); }
.case-text { font-size: 15px; line-height: 1.8; color: var(--text); white-space: pre-wrap; }

.case-sidebar-section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.case-sidebar-section h3 { margin: 0 0 16px; font-size: 15px; color: var(--ink); }

.party-list { list-style: none; margin: 0; padding: 0; }
.party-list li { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.party-list li:last-child { border-bottom: 0; }
.party-type { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; }
.party-name { font-size: 14px; color: var(--text); }

.reference-list { list-style: none; margin: 0; padding: 0; }
.reference-list li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.reference-list li:last-child { border-bottom: 0; }
.reference-type { font-size: 12px; font-weight: 600; color: var(--accent); text-transform: uppercase; }
.reference-text { font-size: 14px; color: var(--text); display: block; margin-top: 2px; }
.reference-details { font-size: 13px; color: var(--muted); font-family: var(--mono); }

.case-info { margin: 0; }
.case-info dt { font-size: 13px; color: var(--muted); margin-top: 12px; }
.case-info dd { font-size: 14px; color: var(--text); margin: 4px 0 0; }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-cloud .tag { font-size: 12px; padding: 2px 8px; }

.similar-cases { list-style: none; margin: 0; padding: 0; }
.similar-cases li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.similar-cases li:last-child { border-bottom: 0; }
.similar-cases a { display: flex; justify-content: space-between; text-decoration: none; color: var(--text); font-size: 14px; }
.similar-cases a:hover { color: var(--ink); }
.similar-signature { font-family: var(--mono); color: var(--accent); }
.similar-date { font-size: 12px; color: var(--muted); }

/* Mobile */
@media (max-width: 767px) {
    .nav { display: none; }
    .page { padding-top: 24px; }
    .page-head h1 { font-size: 24px; }
    
    .search { grid-template-columns: 1fr; }
    .btn { justify-content: center; }
    
    .tender { grid-template-columns: 1fr; padding: 16px; }
    .deadline { text-align: left; display: flex; gap: 10px; align-items: baseline; }
    
    /* Legal search mobile */
    .legal-search .search-main { grid-template-columns: 1fr; }
    .legal-search .search-filters { grid-template-columns: 1fr 1fr; }
    
    .judgment-list .judgment { padding: 16px; }
    .judgment-header { flex-direction: column; align-items: flex-start; }
    .judgment-title { font-size: 16px; }
    .judgment-footer { flex-direction: column; gap: 12px; align-items: flex-start; }
    
    /* Case detail mobile */
    .case-layout { grid-template-columns: 1fr; }
    .case-sidebar { order: -1; }
    .case-actions { flex-direction: column; }
    .case-actions .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}
