:root {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #17202a;
    background: #f3f5f7;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
}

.topbar {
    min-height: 64px;
    padding: 16px max(20px, env(safe-area-inset-left));
    background: #ffffff;
    border-bottom: 1px solid #dfe4e8;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.container {
    width: min(760px, 100%);
    margin: 0 auto;
    padding: 24px 16px;
}

.card {
    padding: 24px;
    background: #ffffff;
    border: 1px solid #dfe4e8;
    border-radius: 16px;
    box-shadow: 0 4px 18px rgb(0 0 0 / 6%);
}

.login-card {
    max-width: 420px;
    margin: 8vh auto 0;
}

label {
    display: block;
    margin: 18px 0 6px;
    font-weight: 650;
}

input {
    width: 100%;
    min-height: 48px;
    padding: 10px 12px;
    border: 1px solid #aeb8c2;
    border-radius: 10px;
    font: inherit;
}

button {
    min-height: 46px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.primary {
    width: 100%;
    margin-top: 22px;
    border: 0;
    border-radius: 10px;
    color: #ffffff;
    background: #1d5f45;
}

.link-button {
    border: 0;
    background: transparent;
    color: #1d5f45;
}

.error {
    padding: 12px;
    border-radius: 10px;
    background: #fdecec;
    color: #8a1f1f;
}

.eyebrow {
    margin-bottom: 4px;
    font-size: 0.875rem;
    color: #5c6770;
}

a {
    color: inherit;
}

.brand {
    font-weight: 800;
    text-decoration: none;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.small-link {
    color: #1d5f45;
    font-size: 0.9rem;
    font-weight: 700;
}

.page-heading {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.page-heading h1,
.guest-card h2,
.record-row h2 {
    margin: 0;
}

.role-badge {
    padding: 7px 10px;
    border-radius: 999px;
    background: #e6efe9;
    color: #174a37;
    font-size: 0.82rem;
    font-weight: 800;
}

.guest-card,
.record-row {
    margin-bottom: 14px;
    padding: 18px;
    background: #ffffff;
    border: 1px solid #dfe4e8;
    border-radius: 14px;
}

.guest-card-heading {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.tour-name,
.location-name,
.identifier,
.change-info {
    margin: 0 0 5px;
    color: #5c6770;
    font-size: 0.86rem;
}

.change-info {
    margin-top: 14px;
}

.status {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    padding: 7px 10px;
    border-radius: 999px;
    background: #edf0f2;
    font-size: 0.82rem;
    font-weight: 800;
    white-space: nowrap;
}

.status-ARRIVED,
.status-RETURNED {
    background: #dff3e8;
    color: #135c39;
}

.status-PICKED_UP,
.status-RETURN_PICKED_UP,
.status-RETURN_READY {
    background: #e3edf9;
    color: #174f84;
}

.status-ABSENT,
.status-NOT_FOUND {
    background: #f8e8e8;
    color: #842828;
}

.status-CLARIFY,
.status-missing {
    background: #fff0ce;
    color: #795500;
}

.action-grid {
    margin-top: 16px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

.action-grid.compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.status-button {
    width: 100%;
    min-height: 52px;
    padding: 8px;
    border: 1px solid #98a6af;
    border-radius: 10px;
    background: #ffffff;
    color: #17202a;
}

.status-button:hover,
.status-button:focus-visible {
    border-color: #1d5f45;
    background: #edf5f1;
}

.record-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px 18px;
}

.record-state {
    text-align: right;
}

.record-state small {
    display: block;
    margin-top: 6px;
    color: #5c6770;
}

.record-actions {
    grid-column: 1 / -1;
}

.record-actions summary {
    color: #1d5f45;
    font-weight: 750;
    cursor: pointer;
}

.management-actions {
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.inline-button,
.secondary-button {
    display: inline-flex;
    width: auto;
    min-height: 46px;
    padding: 0 16px;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.secondary-button {
    border: 1px solid #1d5f45;
    border-radius: 10px;
    color: #1d5f45;
    background: #ffffff;
    font-weight: 750;
}

.statistics-grid {
    margin-bottom: 20px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.stat-card {
    padding: 16px;
    background: #ffffff;
    border: 1px solid #dfe4e8;
    border-radius: 12px;
}

.stat-card strong {
    display: block;
    font-size: 1.7rem;
}

.stat-card span {
    color: #5c6770;
    font-size: 0.83rem;
}

.event-row {
    padding: 12px 0;
    border-bottom: 1px solid #e4e8eb;
    display: flex;
    justify-content: space-between;
    gap: 18px;
}

.event-row:last-child {
    border-bottom: 0;
}

.event-row p {
    margin: 4px 0 0;
}

.event-row small {
    color: #5c6770;
    text-align: right;
}

.messages {
    margin-bottom: 16px;
}

.message {
    padding: 12px 14px;
    border-radius: 10px;
    background: #dff3e8;
    color: #135c39;
}

.technical-list div {
    padding: 10px 0;
    border-bottom: 1px solid #e4e8eb;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.technical-list dt {
    font-weight: 750;
}

.technical-list dd {
    margin: 0;
}

@media (max-width: 640px) {
    .container {
        padding: 18px 12px;
    }

    .action-grid.compact,
    .statistics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .guest-card-heading {
        display: block;
    }

    .guest-card-heading .status {
        margin-top: 12px;
    }

    .record-row {
        grid-template-columns: 1fr;
    }

    .record-state {
        text-align: left;
    }

    .record-actions {
        grid-column: auto;
    }

    .event-row {
        display: block;
    }

    .event-row small {
        display: block;
        margin-top: 6px;
        text-align: left;
    }
}
