:root {
    --bg: #f4f7f5;
    --surface: #ffffff;
    --surface-2: #eef4f0;
    --text: #17211b;
    --muted: #68756d;
    --border: #dce5df;
    --brand: #166534;
    --brand-dark: #14532d;
    --brand-soft: #dcfce7;
    --danger: #b42318;
    --danger-soft: #fee4e2;
    --warning: #8a6100;
    --warning-soft: #fff3cd;
    --info: #175cd3;
    --info-soft: #eaf2ff;
    --shadow: 0 8px 28px rgba(21, 62, 38, .08);
    --radius: 16px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.container { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }
.page { padding: 28px 0 100px; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-header h1 { margin: 0; font-size: clamp(1.6rem, 3vw, 2.2rem); line-height: 1.15; }
.page-header p { margin: 7px 0 0; color: var(--muted); }

.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.topbar-inner { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.02em; }
.brand-mark { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--brand); color: white; font-size: 20px; box-shadow: var(--shadow); }
.desktop-nav { display: flex; align-items: center; gap: 8px; }
.nav-link { padding: 10px 13px; border-radius: 10px; color: var(--muted); font-weight: 650; }
.nav-link:hover, .nav-link.active { color: var(--brand-dark); background: var(--brand-soft); }
.user-area { display: flex; align-items: center; gap: 10px; }
.user-name { color: var(--muted); font-size: .92rem; }

.mobile-nav { display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: rgba(255,255,255,.97); border-top: 1px solid var(--border); padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); backdrop-filter: blur(12px); }
.mobile-nav-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; max-width: 620px; margin: 0 auto; }
.mobile-nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 5px; border-radius: 11px; color: var(--muted); font-size: .78rem; font-weight: 700; }
.mobile-nav a.active { color: var(--brand-dark); background: var(--brand-soft); }
.mobile-nav .icon { font-size: 1.15rem; line-height: 1; }

.grid { display: grid; gap: 18px; }
.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)); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-body { padding: 20px; }
.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 18px 20px 0; }
.card-title { margin: 0; font-size: 1.12rem; line-height: 1.35; }
.card-subtitle { margin: 5px 0 0; color: var(--muted); font-size: .93rem; }
.event-card { overflow: hidden; }
.event-meta { display: grid; gap: 7px; margin: 17px 0; color: var(--muted); font-size: .95rem; }
.event-meta strong { color: var(--text); }
.event-actions { border-top: 1px solid var(--border); padding: 16px 20px 20px; background: #fbfdfb; }
.event-actions h3 { font-size: .92rem; margin: 0 0 10px; }

.chip, .badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; font-size: .78rem; font-weight: 800; line-height: 1; }
.chip { padding: 7px 9px; background: var(--surface-2); color: var(--brand-dark); }
.badge { padding: 7px 10px; }
.badge-present { background: var(--brand-soft); color: var(--brand-dark); }
.badge-absent { background: var(--danger-soft); color: var(--danger); }
.badge-unknown { background: var(--warning-soft); color: var(--warning); }
.badge-info { background: var(--info-soft); color: var(--info); }

.choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 15px; border-radius: 11px; border: 1px solid transparent; font-weight: 750; transition: transform .08s ease, background .15s ease, border-color .15s ease; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: white; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: white; }
.btn-ghost-danger { background: white; color: var(--danger); border-color: #f0b8b4; }
.btn-present { background: white; color: var(--brand-dark); border-color: #b7d8c1; }
.btn-present.active { background: var(--brand); color: white; border-color: var(--brand); }
.btn-absent { background: white; color: var(--danger); border-color: #f0b8b4; }
.btn-absent.active { background: var(--danger); color: white; border-color: var(--danger); }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 7px 11px; border-radius: 9px; font-size: .88rem; }

.form-group { margin-bottom: 17px; }
.form-label { display: block; margin-bottom: 7px; font-weight: 750; }
.form-help { margin: 6px 0 0; color: var(--muted); font-size: .87rem; }
.input, .select, .textarea { width: 100%; border: 1px solid #cfd8d2; border-radius: 11px; background: white; color: var(--text); padding: 11px 12px; outline: none; min-height: 46px; }
.textarea { min-height: 110px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(22,101,52,.12); }
.form-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.field-error { color: var(--danger); font-size: .85rem; margin-top: 5px; }

.alert { padding: 13px 15px; border-radius: 12px; margin-bottom: 18px; border: 1px solid transparent; }
.alert-success { background: var(--brand-soft); color: var(--brand-dark); border-color: #b7e7c3; }
.alert-error { background: var(--danger-soft); color: #7a271a; border-color: #f4c5c2; }
.alert ul { margin: 7px 0 0 18px; padding: 0; }

.stat { padding: 18px; }
.stat-label { color: var(--muted); font-size: .88rem; font-weight: 700; }
.stat-value { margin-top: 5px; font-size: 1.9rem; font-weight: 850; line-height: 1; }
.stat-note { margin-top: 7px; color: var(--muted); font-size: .86rem; }

.list { display: grid; gap: 10px; }
.list-item { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 15px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); }
.list-main { min-width: 0; }
.list-title { font-weight: 800; }
.list-subtitle { color: var(--muted); margin-top: 3px; font-size: .9rem; }

.date-tile { width: 58px; min-width: 58px; height: 58px; border-radius: 13px; display: grid; place-items: center; background: var(--surface-2); text-align: center; }
.date-tile .day { font-size: 1.25rem; font-weight: 850; line-height: 1; }
.date-tile .month { font-size: .72rem; font-weight: 800; color: var(--muted); text-transform: uppercase; margin-top: 3px; }
.program-row { display: flex; align-items: center; gap: 13px; min-width: 0; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 14px; background: white; }
table { width: 100%; border-collapse: collapse; min-width: 700px; }
th, td { padding: 13px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { background: #f8faf8; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: 0; }
.table-actions { display: flex; gap: 7px; flex-wrap: wrap; }

.empty { text-align: center; padding: 38px 20px; color: var(--muted); }
.empty-icon { font-size: 2.4rem; margin-bottom: 10px; }
.muted { color: var(--muted); }
.text-danger { color: var(--danger); }
.text-brand { color: var(--brand-dark); }
.section-title { margin: 30px 0 12px; font-size: 1.08rem; }
.divider { height: 1px; background: var(--border); margin: 20px 0; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 28px 18px; background: radial-gradient(circle at top, #e6f4ea 0, var(--bg) 48%); }
.login-shell { width: min(430px, 100%); }
.login-brand { text-align: center; margin-bottom: 18px; }
.login-brand .brand-mark { margin: 0 auto 10px; width: 52px; height: 52px; font-size: 27px; }
.login-card { padding: 25px; }
.login-card h1 { margin: 0 0 6px; font-size: 1.65rem; }
.login-card > p { color: var(--muted); margin: 0 0 21px; }

.details-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.detail { padding: 13px; background: #f8faf8; border-radius: 12px; }
.detail-label { color: var(--muted); font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.detail-value { margin-top: 4px; font-weight: 700; }

@media (max-width: 860px) {
    .desktop-nav, .user-area .user-name { display: none; }
    .mobile-nav { display: block; }
    .grid-4, .grid-3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .page { padding-top: 20px; }
}

@media (max-width: 620px) {
    .container { width: min(100% - 22px, 1120px); }
    .topbar-inner { min-height: 60px; }
    .brand-mark { width: 34px; height: 34px; border-radius: 10px; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .page-header { align-items: stretch; flex-direction: column; }
    .page-header .btn { width: 100%; }
    .card-body { padding: 17px; }
    .card-header { padding: 16px 17px 0; }
    .event-actions { padding: 14px 17px 17px; }
    .choice-row { gap: 8px; }
    .btn { min-height: 48px; }
    .details-grid { grid-template-columns: 1fr; }
    .list-item { align-items: flex-start; }
    .table-actions { flex-direction: column; }
}

.brand-logo {
    width: 44px;
    height: 44px;
    object-fit: contain;
    display: block;
}

.login-logo {
    width: 90px;
    height: 90px;
    object-fit: contain;
    display: block;
    margin: 0 auto 12px;
}

.match-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    margin: 8px 0 16px;
}

.match-type-cup {
    background: #ed3f36;
    color: #fff;
}

.match-type-league {
    background: #f3f4f6;
    color: #333;
    border: 1px solid #ddd;
}