:root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --text: #16181d;
    --muted: #707680;
    --border: #dfe3e8;
    --accent: #243447;
    --accent-soft: #edf1f5;
    --danger: #8b3434;
    --radius: 16px;
}

* {
    box-sizing: border-box;
}

html {
    font-family:
        Inter,
        ui-sans-serif,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    line-height: 1.45;
}

a {
    color: inherit;
}

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.topbar-inner {
    max-width: 1050px;
    margin: 0 auto;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 18px;
}

.brand {
    font-size: 20px;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}

.main-nav {
    display: flex;
    gap: 6px;
    flex: 1;
    overflow-x: auto;
}

.main-nav a {
    padding: 9px 11px;
    border-radius: 10px;
    text-decoration: none;
    white-space: nowrap;
    font-weight: 600;
    font-size: 14px;
}

.main-nav a:hover {
    background: var(--accent-soft);
}

.logout-form {
    margin: 0;
}

.link-button {
    border: 0;
    background: transparent;
    font: inherit;
    color: var(--muted);
    cursor: pointer;
    padding: 9px;
}

.page {
    max-width: 1050px;
    margin: 0 auto;
    padding: 24px 18px 60px;
}

.narrow-page {
    max-width: 620px;
    margin: 0 auto;
}

.page-heading {
    margin-bottom: 20px;
}

.page-heading h1 {
    margin: 0 0 4px;
    font-size: clamp(25px, 6vw, 34px);
    line-height: 1.15;
}

.page-heading p {
    margin: 0;
    color: var(--muted);
}

.heading-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.form-card,
.detail-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.field {
    margin-bottom: 20px;
    border: 0;
    padding: 0;
}

.field label,
.field legend {
    display: block;
    margin-bottom: 7px;
    font-weight: 700;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    min-height: 46px;
    padding: 11px 12px;
    border: 1px solid #cbd1d8;
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    font: inherit;
    font-size: 16px;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: 3px solid rgba(36, 52, 71, 0.13);
    border-color: var(--accent);
}

.optional {
    font-weight: 400;
    color: var(--muted);
}

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

.task-option {
    min-height: 48px;
    display: flex !important;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin: 0 !important;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    font-weight: 600 !important;
    cursor: pointer;
}

.task-option input {
    width: 20px;
    height: 20px;
    margin: 0;
}

.primary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 11px 16px;
    border: 0;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    text-decoration: none;
    cursor: pointer;
}

.full-width {
    width: 100%;
}

.back-link {
    display: inline-block;
    margin-bottom: 18px;
    color: var(--muted);
    text-decoration: none;
    font-weight: 600;
}

.messages {
    margin-bottom: 18px;
}

.message {
    padding: 12px 14px;
    border-radius: 10px;
    background: #e8f3e9;
    border: 1px solid #c9dfcb;
}

.field-error,
.errorlist {
    color: var(--danger);
    margin-top: 6px;
    font-size: 14px;
}

.errorlist {
    padding-left: 20px;
}

.card-list {
    display: grid;
    gap: 12px;
}

.record-card {
    display: block;
    padding: 17px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: inherit;
    text-decoration: none;
}

a.record-card:hover {
    border-color: #aeb6bf;
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
}

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

.card-top h2 {
    font-size: 19px;
}

.card-date,
.event-name,
.muted {
    color: var(--muted);
}

.event-name {
    margin-top: 2px;
    font-weight: 600;
}

.status {
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.status-pending {
    background: #f4eee2;
}

.status-approved {
    background: #e5edf7;
}

.status-paid {
    background: #e4f1e7;
}

.status-dismissed {
    background: #eeeeee;
}

.task-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 14px;
}

.task-tags span {
    padding: 5px 8px;
    border-radius: 8px;
    background: var(--accent-soft);
    font-size: 13px;
    font-weight: 600;
}

.amount-line {
    margin-top: 15px;
    font-size: 20px;
    font-weight: 800;
}

.card-bottom {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 12px;
}

.card-bottom .card-date {
    text-align: right;
    font-size: 13px;
}

.empty-state {
    padding: 28px 18px;
    background: var(--surface);
    border: 1px dashed #c8cdd3;
    border-radius: var(--radius);
    color: var(--muted);
    text-align: center;
}

.summary-box {
    min-width: 160px;
    padding: 10px 13px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.summary-box span {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.summary-box strong {
    display: block;
    font-size: 22px;
}

.detail-section {
    border-top: 1px solid var(--border);
    margin-top: 20px;
    padding-top: 18px;
}

.detail-section h3 {
    margin: 0 0 9px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
}

.large-amount {
    font-size: 29px;
    font-weight: 800;
}

.info-line {
    margin-bottom: 18px;
    color: var(--muted);
}

.switch-row {
    min-height: 46px;
    display: flex !important;
    align-items: center;
    gap: 10px;
}

.switch-row input {
    width: 22px;
    height: 22px;
}

.inactive-section {
    margin-top: 30px;
}

.inactive-section summary {
    cursor: pointer;
    font-weight: 700;
    margin-bottom: 12px;
}

.compact .record-card {
    padding: 13px 15px;
}

.card-notes {
    margin-bottom: 0;
    color: var(--muted);
}

.worker-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 14px;
}

.worker-stats div {
    padding: 10px;
    border-radius: 10px;
    background: var(--accent-soft);
}

.worker-stats span {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.worker-stats strong {
    display: block;
    font-size: 18px;
}

@media (max-width: 640px) {

    .topbar-inner {
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 8px;
        padding: 12px 14px;
    }

    .brand {
        width: 100%;
    }

    .main-nav {
        order: 3;
        width: 100%;
        padding-bottom: 2px;
    }

    .logout-form {
        position: absolute;
        top: 8px;
        right: 9px;
    }

    .page {
        padding: 18px 12px 44px;
    }

    .heading-row {
        flex-direction: column;
    }

    .summary-box {
        width: 100%;
    }

    .form-card,
    .detail-card {
        padding: 16px;
    }

    .task-grid {
        grid-template-columns: 1fr;
    }

    .record-card {
        padding: 15px;
    }

    .card-top {
        gap: 8px;
    }

    .worker-stats {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

.help-text {
    margin-top: 6px;
    color: var(--muted);
    font-size: 13px;
}

.form-error {
    margin-bottom: 16px;
    padding: 11px 13px;
    border-radius: 10px;
    background: #f6e6e6;
    color: var(--danger);
}


.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 32px;
}

.dashboard-stat {
    display: flex;
    flex-direction: column;
    min-height: 145px;
    padding: 17px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: inherit;
    text-decoration: none;
}

.dashboard-stat:hover {
    border-color: #aeb6bf;
}

.dashboard-label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.dashboard-number {
    margin-top: 7px;
    font-size: 29px;
    line-height: 1.1;
}

.dashboard-detail {
    margin-top: auto;
    padding-top: 13px;
    color: var(--muted);
    font-size: 12px;
}

.dashboard-section-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 30px;
    margin-bottom: 12px;
}

.dashboard-section-heading h2 {
    margin: 0;
    font-size: 20px;
}

.dashboard-section-heading a {
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.dashboard-events {
    margin-bottom: 8px;
}


@media (max-width: 760px) {

    .dashboard-grid {
        grid-template-columns: 1fr 1fr;
    }

}


@media (max-width: 400px) {

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-stat {
        min-height: 110px;
    }

}

/* KED Google Calendar event source */

.source-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    margin-left: 0.4rem;
    padding: 0.18rem 0.48rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.2;
    vertical-align: middle;
}

.source-google {
    background: #eef4ff;
    color: #234f9b;
    border: 1px solid #cbdcff;
}

.google-source-notice {
    margin: 0.75rem 0 1.25rem;
    padding: 0.9rem 1rem;
    border-radius: 12px;
    background: #f5f8ff;
    border: 1px solid #d7e2fa;
    line-height: 1.45;
}

.google-source-notice-title {
    font-weight: 700;
    margin-bottom: 0.25rem;
}

