:root {
    --bg: #f7f7f5;
    --fg: #1d1f24;
    --muted: #6b7280;
    --accent: #1f6feb;
    --border: #d8dadf;
    --card: #ffffff;
    --row-alt: #f3f4f6;
    --error: #b91c1c;
    --flash: #166534;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.4;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1rem;
}

.site-header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
}
.site-header h1 {
    margin: 0 0 0.5rem;
    font-size: 1.5rem;
}
.site-header h1 a {
    color: var(--fg);
    text-decoration: none;
}

nav {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}
.nav-link {
    color: var(--muted);
    text-decoration: none;
    padding: 0.25rem 0;
    font-weight: 500;
}
.nav-link:hover { color: var(--accent); }
.nav-link.active { color: var(--accent); border-bottom: 2px solid var(--accent); }

main { padding: 2rem 0; }

main h2 { margin: 1.5rem 0 0.75rem; font-size: 1.2rem; }
main h2:first-child { margin-top: 0; }

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 1rem;
}
th, td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}
th { background: var(--row-alt); font-weight: 600; }
tr:last-child td { border-bottom: none; }
tbody tr:nth-child(even) { background: var(--row-alt); }

.tables-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
@media (max-width: 720px) {
    .tables-grid { grid-template-columns: 1fr; }
}

.league-table th:nth-child(n+3),
.league-table td:nth-child(n+3) { text-align: center; width: 3rem; }
.league-table td:nth-child(2) { font-weight: 500; }

.fixtures .score { text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; }
.fixtures .team-home { text-align: right; }
.fixtures td:first-child, .fixtures th:first-child { white-space: nowrap; }

.team-link { color: var(--fg); text-decoration: none; border-bottom: 1px dotted var(--border); }
.team-link:hover { color: var(--accent); border-bottom-color: var(--accent); }

.team-header h2 { margin-bottom: 0.25rem; }
.team-header p { margin-top: 0; }
.team-stats { max-width: 30rem; margin-bottom: 1.5rem; }
.team-stats .league-table th, .team-stats .league-table td { text-align: center; }

.team-fixtures .venue { text-align: center; font-weight: 600; color: var(--muted); }
.result { font-weight: 700; padding: 0.1rem 0.4rem; border-radius: 3px; font-size: 0.85rem; }
.result.win { background: #dcfce7; color: #166534; }
.result.loss { background: #fee2e2; color: #b91c1c; }
.result.draw { background: var(--row-alt); color: var(--muted); }

.muted { color: var(--muted); }
.error { color: var(--error); }
.flash {
    color: var(--flash);
    background: #dcfce7;
    border: 1px solid #86efac;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
}

.login-form {
    max-width: 320px;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.login-form label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-weight: 500;
}
input[type="password"], input[type="number"] {
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font: inherit;
}
button {
    padding: 0.4rem 0.9rem;
    background: var(--accent);
    color: white;
    border: 0;
    border-radius: 4px;
    cursor: pointer;
    font: inherit;
    font-weight: 500;
}
button:hover { filter: brightness(1.1); }

.score-form { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.score-input { width: 4.5rem; text-align: center; }
.date-input, .time-input {
    padding: 0.3rem 0.4rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font: inherit;
}
.date-input { width: 8.5rem; }
.time-input { width: 6rem; }

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.admin-subnav {
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}
.admin-subnav a {
    margin-right: 1rem;
    color: var(--muted);
    text-decoration: none;
    font-weight: 500;
}
.admin-subnav a:hover { color: var(--accent); }

.contact-form {
    display: grid;
    grid-template-columns: 1fr 1.5fr 1fr auto;
    gap: 0.4rem;
    align-items: start;
}
.contact-input {
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font: inherit;
    width: 100%;
}
.contact-name    { grid-column: 1; grid-row: 1; }
.contact-email   { grid-column: 2; grid-row: 1; }
.contact-mobile  { grid-column: 3; grid-row: 1; }
.contact-address { grid-column: 1 / 4; grid-row: 2; resize: vertical; font-family: inherit; }
.contact-save    { grid-column: 4; grid-row: 1 / span 2; align-self: center; }
@media (max-width: 720px) {
    .contact-form { grid-template-columns: 1fr; }
    .contact-name, .contact-email, .contact-mobile, .contact-address, .contact-save {
        grid-column: 1; grid-row: auto;
    }
}

.contacts .address { white-space: pre-line; line-height: 1.3; font-size: 0.9rem; }
.link-button {
    background: transparent;
    color: var(--muted);
    padding: 0;
    text-decoration: underline;
}
.link-button:hover { color: var(--accent); }
.inline { display: inline; }

.site-footer {
    border-top: 1px solid var(--border);
    padding: 1rem 0;
    color: var(--muted);
    font-size: 0.9rem;
    background: var(--card);
}
.site-footer a { color: var(--muted); }
