*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    padding: 16px max(12px, env(safe-area-inset-right)) 16px max(12px, env(safe-area-inset-left));
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f4f6f8;
    color: #222;
    line-height: 1.45;
}

.page-wrapper {
    max-width: 900px;
    margin: 0 auto;
}

.site-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    gap: 10px;
    padding: 12px 16px;
    background: #ffffff;
    border: 1px solid #e2e6ea;
    border-radius: 8px;
    margin-bottom: 16px;
}

.nav-brand {
    flex: 0 1 auto;
    min-width: 0;
    white-space: nowrap;
}

.nav-brand a,
.nav-links a {
    white-space: nowrap;
    text-decoration: none;
}

.nav-brand a {
    color: #222;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.site-nav .nav-brand a .brand-person {
    color: #0275d8;
    font-weight: 800;
}

.nav-links {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    flex-shrink: 0;
    gap: 14px;
    font-size: 0.95rem;
}

.nav-links a {
    color: #333;
    font-weight: 600;
}

.nav-links a:hover {
    color: #0275d8;
}

.content-card {
    background: #ffffff;
    border: 1px solid #e2e6ea;
    border-radius: 8px;
    padding: 18px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.welcome-banner {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 14px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

th, td {
    padding: 8px 10px;
    border-bottom: 1px solid #eceff2;
    text-align: left;
}

th {
    font-weight: 700;
    color: #444;
    background: #fafbfc;
    white-space: nowrap;
}

.captain-row {
    background: #fff8f7;
}

input[type="text"],
input[type="password"],
input[type="date"],
input[type="time"],
select,
textarea {
    max-width: 100%;
    font-family: inherit;
}

.site-footer {
    margin-top: 20px;
    padding: 14px 10px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid #e2e6ea;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 18px;
    font-size: 0.85rem;
    color: #666;
}

.site-footer a {
    color: #555;
    text-decoration: none;
}

.site-footer a:hover {
    text-decoration: underline;
}

@media (max-width: 480px) {
    body {
        padding: 10px max(8px, env(safe-area-inset-right)) 10px max(8px, env(safe-area-inset-left));
    }

    .site-nav {
        padding: 10px;
        gap: 6px;
    }

    .nav-brand a {
        font-size: 0.9rem;
        letter-spacing: -0.01em;
    }

    .nav-links {
        gap: 8px;
        font-size: 0.82rem;
    }

    .content-card {
        padding: 14px 10px;
        overflow-x: visible;
    }

    input[type="text"],
    input[type="password"],
    input[type="date"],
    input[type="time"],
    select,
    textarea {
        font-size: 16px;
    }

    .events-table,
    .events-table tbody,
    .events-table tr,
    .events-table td {
        display: block;
        width: 100%;
    }

    .events-table thead {
        display: none;
    }

    .events-table tr {
        background: #ffffff;
        border: 1px solid #dce2e8;
        border-radius: 8px;
        padding: 10px 12px;
        margin-bottom: 12px;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    }

    .events-table tr.captain-row {
        background: #fff8f7;
        border-color: #f3c6c2;
    }

    .events-table td {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 12px;
        padding: 5px 0;
        border-bottom: 1px solid #f0f2f5;
        font-size: 0.9rem;
        text-align: right;
    }

    .events-table td::before {
        content: attr(data-label);
        font-weight: 700;
        color: #555;
        font-size: 0.8rem;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        text-align: left;
        flex: 0 0 auto;
    }

    .events-table td.cell-title {
        display: block;
        text-align: left;
        padding-top: 0;
        padding-bottom: 7px;
        margin-bottom: 2px;
        border-bottom: 1px solid #e5e9ee;
        font-size: 1rem;
    }

    .events-table td.cell-title::before {
        display: none;
    }

    .events-table td:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }
}