:root {
    --bg: #f6f5f0;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #667085;
    --line: #e4e7ec;
    --primary: #1f5132;
    --primary-dark: #153824;
    --accent: #d6a84f;
    --danger: #b42318;
    --success: #067647;
    --shadow: 0 16px 40px rgba(31, 41, 55, .08);
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar {
    background: #fff;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .9rem 1.4rem;
    position: sticky;
    top: 0;
    z-index: 10;
}
.brand {
    display: flex;
    align-items: center;
    gap: .7rem;
    font-weight: 800;
    color: var(--primary-dark);
    text-decoration: none;
}
.brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--primary);
    color: #fff;
    letter-spacing: .04em;
}
.nav {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    justify-content: flex-end;
}
.nav a {
    color: var(--text);
    padding: .55rem .75rem;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    font-size: .94rem;
}
.nav a.active,
.nav a:hover { background: #edf7f0; color: var(--primary); }
.container { max-width: 1180px; margin: 0 auto; padding: 1.4rem; }
.footer { color: var(--muted); text-align: center; padding: 2rem 1rem; font-size: .9rem; }
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 1.25rem;
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}
.card h1, .card h2, .card h3 { margin-top: 0; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat {
    padding: 1rem;
    border-radius: 18px;
    background: linear-gradient(145deg, #fff, #f7faf7);
    border: 1px solid var(--line);
}
.stat strong { display: block; font-size: 1.9rem; color: var(--primary-dark); }
.stat span { color: var(--muted); font-weight: 600; }
label { display: block; font-weight: 700; margin: .7rem 0 .3rem; }
input, select, textarea {
    width: 100%;
    border: 1px solid #d0d5dd;
    border-radius: 12px;
    padding: .75rem .85rem;
    font: inherit;
    background: #fff;
}
textarea { min-height: 110px; resize: vertical; }
button, .button {
    border: none;
    border-radius: 12px;
    padding: .75rem 1rem;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    background: var(--primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    text-decoration: none;
}
button:hover, .button:hover { background: var(--primary-dark); text-decoration: none; }
.button.secondary { background: #eef2f6; color: var(--text); }
.button.danger, button.danger { background: var(--danger); }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-top: 1rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .8rem .65rem; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; }
th { font-size: .82rem; text-transform: uppercase; color: var(--muted); letter-spacing: .04em; }
tr:hover td { background: #fbfcfb; }
.badge {
    display: inline-flex;
    padding: .25rem .55rem;
    border-radius: 999px;
    font-weight: 800;
    font-size: .82rem;
    background: #eef2f6;
    color: var(--text);
    white-space: nowrap;
}
.badge.green { background: #dcfae6; color: var(--success); }
.badge.gold { background: #fff3d1; color: #8a5a00; }
.badge.red { background: #fee4e2; color: var(--danger); }
.alert { padding: .8rem 1rem; border-radius: 14px; margin-bottom: 1rem; font-weight: 700; }
.alert.success { background: #dcfae6; color: var(--success); }
.alert.error { background: #fee4e2; color: var(--danger); }
.alert.info { background: #eef2f6; color: var(--text); }
.login-page { min-height: 80vh; display: grid; place-items: center; }
.login-card { width: min(460px, 100%); }
.help { color: var(--muted); font-size: .92rem; }
.inline-form { display: inline; }
.filters { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .8rem; align-items: end; }
.rank-1 td { background: #fff9e8; }
@media (max-width: 880px) {
    .topbar { align-items: flex-start; flex-direction: column; }
    .nav { justify-content: flex-start; }
    .grid-2, .grid-3, .grid-4, .filters { grid-template-columns: 1fr; }
}
button.secondary { background: #eef2f6; color: var(--text); }
code { background: #eef2f6; padding: .15rem .35rem; border-radius: 6px; }
