:root {
    --bg: #f5f7fb;
    --card: #ffffff;
    --text: #182233;
    --muted: #667085;
    --line: #d8deea;
    --accent: #0f766e;
    --accent-dark: #115e59;
    --danger: #b42318;
    --warning: #b54708;
    --success: #027a48;
    --shadow: 0 10px 35px rgba(16, 24, 40, 0.08);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
    margin: 0;
    min-height: 100%;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.45;
}

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

.container {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
}

.site-header {
    background: #0b1220;
    color: white;
    border-bottom: 4px solid var(--accent);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 0;
}

.brand {
    color: white;
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: .02em;
}

.nav {
    display: flex;
    gap: 14px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.nav a { color: #d7e3f4; font-weight: 600; }
.nav a:hover { color: white; }

.main { padding: 28px 0 48px; }

.site-footer {
    color: var(--muted);
    border-top: 1px solid var(--line);
    padding: 24px 0;
}
.site-footer .container { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

h1, h2, h3 { line-height: 1.15; margin-top: 0; }
h1 { font-size: clamp(2rem, 4vw, 3.4rem); margin-bottom: 10px; }
h2 { margin-top: 32px; }
p { color: var(--muted); }

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr);
    gap: 24px;
    align-items: stretch;
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 22px;
    box-shadow: var(--shadow);
}

.card.compact { padding: 16px; }

.grid {
    display: grid;
    gap: 18px;
}
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.button, button, input[type="submit"] {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 999px;
    background: var(--accent);
    color: white;
    font-weight: 700;
    padding: 10px 16px;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.95rem;
}
.button:hover, button:hover, input[type="submit"]:hover { background: var(--accent-dark); text-decoration: none; }
.button.secondary { background: #344054; }
.button.small { padding: 7px 12px; font-size: .85rem; }
button[disabled], input[disabled], select[disabled] { opacity: .65; cursor: not-allowed; }

.form-card {
    max-width: 520px;
    margin: 0 auto;
}

label { display: block; font-weight: 700; margin-bottom: 6px; }
input[type="text"], input[type="password"], input[type="number"], select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 12px;
    background: white;
    color: var(--text);
    font: inherit;
}
.input-row { margin-bottom: 16px; }
.help { color: var(--muted); font-size: .9rem; margin-top: 6px; }

.flash {
    border-radius: 14px;
    padding: 12px 16px;
    margin-bottom: 18px;
    border: 1px solid var(--line);
    background: white;
}
.flash.success { border-color: #abefc6; background: #ecfdf3; color: var(--success); }
.flash.error { border-color: #fecdca; background: #fef3f2; color: var(--danger); }
.flash.info { border-color: #b2ddff; background: #eff8ff; color: #175cd3; }

.table-wrap { overflow-x: auto; border-radius: 16px; border: 1px solid var(--line); background: white; }
table { width: 100%; border-collapse: collapse; min-width: 780px; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f8fafc; color: #344054; font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: 0; }
.rank { font-weight: 800; font-size: 1.05rem; }

.badge, .status {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: .8rem;
    font-weight: 800;
    white-space: nowrap;
}
.badge { background: #e6f4f1; color: var(--accent-dark); }
.status.open { background: #ecfdf3; color: var(--success); }
.status.locked { background: #fff7ed; color: var(--warning); }
.status.final { background: #eef4ff; color: #3538cd; }

.match-list { display: grid; gap: 12px; }
.match-card {
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px;
    background: white;
}
.match-card header { display: flex; justify-content: space-between; gap: 12px; align-items: start; margin-bottom: 10px; }
.match-title { font-weight: 800; }
.meta { color: var(--muted); font-size: .92rem; }
.radio-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.radio-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 12px;
    font-weight: 700;
    background: #fff;
}

.group-picker {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.admin-table input[type="number"] { width: 76px; }
.admin-table select { min-width: 160px; }
.admin-table .team-select { min-width: 190px; }

.standings {
    display: grid;
    gap: 12px;
}
.standings table { min-width: 560px; }

.kicker { color: var(--accent); font-weight: 800; text-transform: uppercase; letter-spacing: .08em; font-size: .85rem; }
.notice {
    padding: 14px 16px;
    border: 1px solid #fedf89;
    background: #fffaeb;
    color: #93370d;
    border-radius: 14px;
    margin-bottom: 18px;
}

@media (max-width: 800px) {
    .header-inner { align-items: flex-start; flex-direction: column; }
    .nav { justify-content: flex-start; }
    .hero, .grid.two, .grid.three { grid-template-columns: 1fr; }
    .group-picker { grid-template-columns: 1fr; }
}

button.small { padding: 7px 12px; font-size: .85rem; }
code {
    background: #f2f4f7;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 2px 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
