:root {
    --bg: #f7f7f9;
    --text: #222;
    --muted: #666;
    --card: #ffffff;
    --border: #eee;
    --accent: #0b57d0;
    --shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
}

* { box-sizing: border-box; }

body {
    font-family: Arial, sans-serif;
    margin: 0;
    background: var(--bg);
    color: var(--text);
}

h1, h2, h3 { margin-top: 0; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* Top navigation */
.navbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--card);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 12px 24px;
}

.navbar .brand {
    font-weight: bold;
    font-size: 18px;
    color: var(--text);
    white-space: nowrap;
}

.navbar .brand:hover { text-decoration: none; }

.nav-links {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.nav-links a { color: var(--text); font-weight: 500; }
.nav-links a:hover { color: var(--accent); text-decoration: none; }

.nav-search { display: flex; gap: 8px; flex: 1 1 260px; max-width: 380px; }
.nav-search input { flex: 1; min-width: 0; padding: 10px; border: 1px solid #ddd; border-radius: 8px; }
.nav-search button { padding: 10px 14px; border: none; border-radius: 8px; background: var(--accent); color: white; cursor: pointer; }
.nav-search button:hover { opacity: 0.9; }

.freshness {
    padding: 8px 24px;
    font-size: 13px;
    color: var(--muted);
}

/* Page header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    gap: 16px;
    flex-wrap: wrap;
}

/* Flash messages */
.flash-messages { margin-bottom: 20px; }

.flash {
    background: #e7f6ea;
    color: #1b5e20;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 8px;
    box-shadow: var(--shadow);
}

.muted { color: var(--muted); }

/* Stat cards */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.card {
    background: var(--card);
    border-radius: 12px;
    padding: 18px;
    box-shadow: var(--shadow);
}

.big { font-size: 28px; font-weight: bold; }

/* Tables */
.table-wrap {
    overflow-x: auto;
    background: var(--card);
    box-shadow: var(--shadow);
    border-radius: 12px;
}

table { width: 100%; border-collapse: collapse; min-width: 560px; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; white-space: nowrap; }
td.wrap, th.wrap { white-space: normal; }
th { background: #fafafa; }
th a { color: var(--text); }
th a:hover { color: var(--accent); }
tr:last-child td { border-bottom: none; }

.sort-arrow { font-size: 11px; color: var(--accent); margin-left: 4px; }

.section { margin-bottom: 28px; }

.badge { display: inline-block; padding: 4px 8px; border-radius: 999px; font-size: 12px; white-space: nowrap; }
.active { background: #e7f6ea; color: #1b5e20; }
.removed { background: #fdecea; color: #b71c1c; }

.row { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--muted);
    background: var(--card);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

/* Filter form */
.filters {
    background: var(--card);
    box-shadow: var(--shadow);
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: end;
}

.filters .field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: var(--muted);
}

.filters input, .filters select {
    padding: 9px 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
}

.filters .actions { display: flex; gap: 8px; }

.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    background: var(--accent);
    color: white;
    cursor: pointer;
    font-size: 14px;
    display: inline-block;
}
.btn:hover { opacity: 0.9; text-decoration: none; }

.btn-secondary {
    background: transparent;
    color: var(--text);
    border: 1px solid #ddd;
}
.btn-secondary:hover { background: #f0f0f0; }

.results-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    color: var(--muted);
    font-size: 14px;
}

/* Pagination */
.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
}

.pagination a, .pagination span {
    min-width: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    border-radius: 8px;
    background: var(--card);
    box-shadow: var(--shadow);
    color: var(--text);
}

.pagination a:hover { color: var(--accent); text-decoration: none; }
.pagination .current { background: var(--accent); color: white; font-weight: bold; }
.pagination .disabled { opacity: 0.4; }

@media (max-width: 900px) {
    .row { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
    .filters { flex-direction: column; align-items: stretch; }
    .filters .field { width: 100%; }
    .filters input, .filters select { width: 100%; }
    .container { padding: 16px; }
    .navbar { padding: 12px 16px; }
}
