* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: Arial, Helvetica, sans-serif; background: #f5f5f5; color: #222; }
.top-banner { position: relative; display: flex; flex-direction: column; align-items: center; padding: 28px 20px 20px; background: #222; color: white; }
.site-title { font-size: 2.5rem; font-weight: bold; letter-spacing: 2px; text-align: center; margin-bottom: 20px; }
.top-nav { display: flex; justify-content: center; gap: 8px; }
.top-nav a { padding: 10px 20px; color: white; text-decoration: none; border-radius: 4px; }
.top-nav a:hover, .top-nav a.active { background: #444; }
.page-layout { display: flex; min-height: calc(100vh - 150px); }
.side-menu { width: 240px; flex-shrink: 0; padding: 24px 16px; background: #e9e9e9; border-right: 1px solid #d0d0d0; }
.side-menu nav { display: flex; flex-direction: column; gap: 4px; }
.side-menu a { padding: 10px 12px; color: #222; text-decoration: none; border-radius: 4px; }
.side-menu a:hover, .side-menu a.active { background: #d5d5d5; }
.trip-dropdown { width: 100%; }
.trip-dropdown summary { padding: 10px 12px; font-weight: bold; cursor: pointer; border-radius: 4px; list-style-position: inside; }
.trip-dropdown summary:hover { background: #d5d5d5; }
.trip-dropdown nav { padding-left: 12px; margin-top: 4px; display: flex; flex-direction: column; gap: 4px; }
.page-content { flex: 1; padding: 40px; max-width: 1200px; }
.page-content h1 { margin-top: 0; }
.home-content { max-width: none; text-align: center; }
.trips-overview { max-width: none; }
.narrow-content { max-width: 800px; }
.page-heading-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 24px; }
.heading-actions { flex-shrink: 0; }
.trip-list { display: flex; flex-direction: column; gap: 16px; max-width: 500px; }
.trip-card { display: block; padding: 20px; color: #222; text-decoration: none; background: white; border: 1px solid #d0d0d0; border-radius: 6px; }
.trip-card:hover { background: #f0f0f0; }
.trip-card h2 { margin: 0 0 8px; }
.trip-card p { margin: 0; }
.button { display: inline-block; border: 1px solid #222; background: #222; color: white; padding: 10px 16px; border-radius: 4px; text-decoration: none; cursor: pointer; font: inherit; }
.button:hover { background: #444; }
.button.secondary { background: #eee; color: #222; border-color: #bbb; }
.button.danger { background: #8b2020; border-color: #8b2020; }
.button:disabled { opacity: .6; cursor: not-allowed; }
.button-row { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.editor-panel, .upload-panel { margin-top: 24px; padding: 24px; background: white; border: 1px solid #d0d0d0; border-radius: 6px; }
.editor-form { display: flex; flex-direction: column; gap: 8px; max-width: 800px; }
.editor-form label { font-weight: bold; margin-top: 8px; }
.editor-form input, .editor-form textarea, .upload-panel input { width: 100%; padding: 10px; border: 1px solid #bbb; border-radius: 4px; font: inherit; }
.editor-form textarea { resize: vertical; }
.editor-form small { color: #666; }
.status { min-height: 1.5em; margin-top: 10px; }
.status.error { color: #a00000; }
.status.success { color: #166534; }
.budget-page { max-width: none; }
.budget-value { min-height: 45vh; display: flex; align-items: center; justify-content: center; font-size: clamp(4rem, 12vw, 9rem); font-weight: bold; text-align: center; }
.payments-heading { align-items: center; }
.payments-heading h1 { margin: 0; }
.upload-controls { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin: 0; }
.file-picker { display: inline-flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid #bbb; border-radius: 4px; background: white; cursor: pointer; }
.file-picker input { max-width: 220px; }
.upload-controls .status { flex-basis: 100%; text-align: right; margin: 0; }
.table-container { margin-top: 24px; overflow-x: auto; }
.data-table { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; background: white; }
.data-table th, .data-table td { padding: 10px 12px; border-right: 1px solid #d0d0d0; border-bottom: 1px solid #d0d0d0; text-align: left; white-space: nowrap; }
.data-table th { background: #e9e9e9; }
.data-table th:first-child, .data-table td:first-child { border-left: 1px solid #d0d0d0; }
.sticky-column { position: sticky; z-index: 2; background: white; }
.data-table th.sticky-column { background: #e9e9e9; z-index: 3; }
.sticky-name { left: 0; min-width: 160px; }
.sticky-total { left: 160px; min-width: 150px; box-shadow: 4px 0 6px -6px #222; }
@media (max-width: 700px) {
    .site-title { font-size: 2rem; }
    .top-nav { flex-wrap: wrap; }
    .page-layout { flex-direction: column; }
    .side-menu { width: 100%; border-right: none; border-bottom: 1px solid #d0d0d0; }
    .page-content { padding: 24px; }
    .page-heading-row { flex-direction: column; }
    .payments-heading { align-items: stretch; }
    .upload-controls { justify-content: flex-start; }
    .upload-controls .status { text-align: left; }
    .file-picker { width: 100%; justify-content: space-between; }
    .file-picker input { max-width: 100%; }
}

/* Payment upload action */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}
.upload-button {
    margin: 0;
}
.upload-status {
    text-align: right;
    margin-top: -14px;
    margin-bottom: 8px;
}

.button.disabled {
    opacity: .6;
    pointer-events: none;
}

/* Compact trip actions */
.compact-action { padding: 7px 11px; font-size: 0.9rem; }

/* Trip cost section */
.trip-cost-summary { font-size: 1.15rem; font-weight: bold; margin: 4px 0 18px; }
.trip-cost-table { width: 100%; max-width: 760px; border-collapse: collapse; background: white; }
.trip-cost-table th, .trip-cost-table td { padding: 10px 12px; border: 1px solid #d0d0d0; text-align: left; }
.trip-cost-table th { background: #e9e9e9; }


/* Payment information / Swish QR */
.payment-info-page { max-width: 1000px; }
.payment-info-text { max-width: 850px; font-size: 1.05rem; line-height: 1.6; }
.swish-qr-frame {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 24px;
    padding: clamp(16px, 3vw, 32px);
    background: #000;
    border-radius: 8px;
    max-width: 100%;
}
.swish-qr-image {
    display: block;
    width: min(340px, 100%);
    height: auto;
}

[hidden] { display: none !important; }

/* Authentication */
.auth-pending { visibility: hidden; }
.logout-button {
    position: absolute;
    top: 12px;
    right: 14px;
    padding: 6px 10px;
    border: 1px solid #666;
    border-radius: 4px;
    background: transparent;
    color: white;
    cursor: pointer;
    font: inherit;
    font-size: 0.82rem;
}
.logout-button:hover { background: #444; }
.login-page { min-height: 100vh; background: #f5f5f5; }
.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.login-card {
    width: min(440px, 100%);
    padding: 32px;
    background: white;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
}
.login-site-title {
    margin-bottom: 24px;
    font-size: 1.35rem;
    font-weight: bold;
    letter-spacing: 1px;
    text-align: center;
}
.login-card h1 { margin-top: 0; }
.login-form { max-width: none; }
.login-form .button { margin-top: 8px; }


/* Login password visibility toggle */
.password-field {
    position: relative;
}
.password-field input {
    padding-right: 46px;
}
.password-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #555;
    cursor: pointer;
    border-radius: 4px;
}
.password-toggle:hover,
.password-toggle:focus-visible {
    background: #eee;
    outline: none;
}
.password-eye {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.password-eye-slash {
    display: block;
}
.password-toggle.showing-password .password-eye-slash {
    display: none;
}
@media (max-width: 700px) {
    .logout-button {
        top: 8px;
        right: 8px;
        padding: 5px 8px;
        font-size: 0.76rem;
    }
}
