:root {
    --bg: #f4f6f8;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;
    --primary: #1f6feb;
    --primary-hover: #195fc9;
    --success: #16803d;
    --warning-bg: #fff7e6;
    --warning-border: #f0b429;
    --error-bg: #fdecec;
    --error-border: #dc2626;
}

* {
    box-sizing: border-box;
}

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

.page {
    width: min(100% - 32px, 1000px);
    margin: 0 auto;
}

header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    margin-bottom: 32px;
}

.header-inner {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand {
    font-size: 24px;
    font-weight: 700;
    text-decoration: none;
    color: var(--text);
}

nav {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
}

nav a {
    color: var(--muted);
    text-decoration: none;
}

nav a:hover {
    color: var(--text);
}

main {
    padding-bottom: 48px;
}

.hero {
    margin-bottom: 28px;
}

.hero h1 {
    margin: 0 0 8px;
    font-size: clamp(28px, 5vw, 42px);
}

.hero p {
    margin: 0;
    color: var(--muted);
    font-size: 17px;
}

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

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}

.card h2,
.card h3 {
    margin-top: 0;
}

.field {
    margin-bottom: 18px;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 7px;
}

input[type="text"],
input[type="url"],
input[type="email"],
input[type="password"],
select {
    width: 100%;
    box-sizing: border-box;
    padding: 11px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: white;
    color: var(--text);
    font-size: 15px;
}

input:focus,
select:focus {
    outline: 2px solid rgba(31, 111, 235, 0.2);
    border-color: var(--primary);
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 20px;
}

.checkbox-row label {
    margin: 0;
    font-weight: 400;
}

.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    padding: 11px 18px;
    background: var(--primary);
    color: white;
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.button:hover,
button:hover {
    background: var(--primary-hover);
}

.button-secondary {
    background: #eef2f7;
    color: var(--text);
}

.button-secondary:hover {
    background: #e2e8f0;
}

.button-danger {
    background: #dc2626;
}

.button-danger:hover {
    background: #b91c1c;
}

.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.alert {
    border-radius: 10px;
    padding: 14px 16px;
    margin: 16px 0;
    border: 1px solid;
}

.alert-warning {
    background: var(--warning-bg);
    border-color: var(--warning-border);
}

.alert-error {
    background: var(--error-bg);
    border-color: var(--error-border);
}

.alert-success {
    background: #ebf8ef;
    border-color: #32a852;
}

.report-item {
    padding: 18px 0;
    border-top: 1px solid var(--border);
}

.report-item:first-of-type {
    border-top: 0;
}

.meta {
    color: var(--muted);
    margin-top: 4px;
}

.team-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: center;
    padding: 16px 0;
    border-top: 1px solid var(--border);
}

.team-row:first-of-type {
    border-top: 0;
}

.team-url {
    color: var(--muted);
    font-size: 13px;
    overflow-wrap: anywhere;
    margin-top: 4px;
}

.spinner {
    width: 58px;
    height: 58px;
    margin: 28px auto;
    border: 6px solid #dbe2ea;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

.center {
    text-align: center;
}

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

.season-badge {
    display: inline-block;
    margin: 4px 0 8px;
    padding: 4px 9px;
    border-radius: 999px;
    background: #eef2f7;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.report-label {
    margin-bottom: 6px;
    color: var(--primary);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 720px) {

    body {
        font-size: 16px;
    }

    .page {
        width: min(100% - 20px, 1000px);
    }

    header {
        margin-bottom: 20px;
    }

    .header-inner {
        min-height: auto;
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
        padding: 14px 0;
    }

    .brand {
        font-size: 22px;
    }

    nav {
        width: 100%;
        gap: 10px;
    }

    nav a {
        padding: 6px 0;
    }

    main {
        padding-bottom: 28px;
    }

    .hero {
        margin-bottom: 20px;
    }

    .hero h1 {
        font-size: 28px;
        line-height: 1.15;
    }

    .hero p {
        font-size: 15px;
        line-height: 1.5;
    }

    .grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .card {
        padding: 18px;
        border-radius: 12px;
    }

    .field {
        margin-bottom: 16px;
    }

    input[type="text"],
    input[type="url"],
    input[type="email"],
    input[type="password"],
    select {
        min-height: 46px;
        font-size: 16px;
    }

    .checkbox-row {
        align-items: flex-start;
        gap: 10px;
    }

    .checkbox-row input {
        width: 20px;
        height: 20px;
        margin-top: 1px;
    }

    .button,
    button {
        width: 100%;
        min-height: 46px;
        padding: 12px 16px;
        font-size: 16px;
    }

    .nav-button {
        width: auto;
        min-height: auto;
        padding: 6px 0;
    }

    .actions {
        flex-direction: column;
        width: 100%;
    }

    .actions .button,
    .actions button,
    .actions form {
        width: 100%;
    }

    .actions form button {
        width: 100%;
    }

    .team-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .team-url {
        font-size: 12px;
        line-height: 1.4;
        word-break: break-word;
    }

    .report-item h2 {
        font-size: 22px;
    }

    .season-badge {
        margin-top: 2px;
    }

    .alert {
        padding: 12px 14px;
        font-size: 14px;
        line-height: 1.5;
    }

    .spinner {
        width: 50px;
        height: 50px;
    }
}

@media (max-width: 420px) {

    .page {
        width: min(100% - 16px, 1000px);
    }

    .card {
        padding: 15px;
    }

    .hero h1 {
        font-size: 25px;
    }

    .brand {
        font-size: 20px;
    }
}

.search-results {
    margin-top: 8px;
}

.search-result {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;

    padding: 12px 14px;
    margin-top: 6px;

    border: 1px solid var(--border);
    border-radius: 8px;

    background: white;
    color: var(--text);

    text-align: left;
}

.search-result:hover {
    background: #f8fafc;
    border-color: var(--primary);
}

.search-result-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.search-result-main span,
.search-result-meta {
    color: var(--muted);
    font-size: 13px;
}

.search-info {
    padding: 10px 0;
    color: var(--muted);
    font-size: 14px;
}

.selected-team {
    margin-top: 8px;
    padding: 12px;

    border-radius: 8px;
    border: 1px solid #32a852;

    background: #ebf8ef;

    font-size: 14px;
}

.selected-team span {
    color: var(--muted);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

button:disabled:hover {
    background: var(--primary);
}

/* --------------------------------------------------
   Login
-------------------------------------------------- */

.login-card {
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
}

.login-card input[type="text"],
.login-card input[type="password"] {
    width: 100%;
    box-sizing: border-box;
    padding: 12px;
    font: inherit;
}

/* --------------------------------------------------
   Logout
-------------------------------------------------- */
.logout-form {
    margin: 0;
    display: inline;
}

.nav-button {
    width: auto;
    min-height: auto;
    padding: 0;

    border: 0;
    border-radius: 0;

    background: transparent;
    color: var(--muted);

    font: inherit;
    font-weight: 400;

    cursor: pointer;
}

.nav-button:hover {
    background: transparent;
    color: var(--text);
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0;
    font-weight: 400;
    cursor: pointer;
}

.radio-option input {
    margin: 0;
}

.team-main {
    width: 100%;
}

.auto-report-form {
    margin-top: 10px;
}

.auto-report-toggle {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 10px;
    font-weight: 600;
}

.team-action-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.auto-report-days {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.auto-report-days label {
    font-weight: 600;
}

.auto-report-days select {
    min-width: 180px;
}

.team-action-row .button,
.team-action-row .button-danger,
.team-action-row button {
    margin: 0;
}

.hidden-form {
    display: none;
}

.auto-report-warning {
    margin: 6px 0 10px 0;
    font-size: 0.9rem;
    color: #856404;
}

.auto-report-warning a {
    font-weight: 600;
}

.flash-message {
    padding: 12px 16px;
    margin-bottom: 16px;
    border-radius: 8px;
    font-weight: 600;
}

.flash-error {
    background: #f8d7da;
    color: #842029;
    border: 1px solid #f5c2c7;
}

.flash-success {
    background: #d1e7dd;
    color: #0f5132;
    border: 1px solid #badbcc;
}