body {
    font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
    margin: 0;
}

html.osd-form-page,
html.osd-form-page body {
    height: 100%;
}

html.osd-form-page--index,
html.osd-form-page--index body {
    overflow: hidden;
}

.osd-form-shell--index {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
}

.osd-form-shell--index .site-header {
    flex-shrink: 0;
}

.osd-form-shell--index .form-page--with-header {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-top: 20px;
    padding-bottom: 24px;
}

.osd-form-shell--index .form-page--with-header .bgSquare {
    top: 0;
    height: 0;
    min-height: 0;
}

.osd-form-shell--index .form-page {
    min-height: 0;
}

.site-header {
    background: #009ee2;
    color: #fff;
    padding: 18px 0;
    box-shadow: rgba(0, 0, 0, 0.24) 0 3px 8px;
    position: relative;
    z-index: 2;
}

.site-header--blank {
    padding: 48px 0;
    min-height: 96px;
}

.site-header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.site-header-title {
    margin: 0;
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.3;
    color: #fff;
    text-align: center;
}

.site-header-brand {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.site-header-logo {
    width: 180px;
    height: auto;
    border-radius: 6px;
    flex-shrink: 0;
}

.site-header-text h1 {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
    margin: 0;
    color: #fff;
}

.site-header-text p {
    margin: 2px 0 0;
    font-size: 0.875rem;
    opacity: 0.88;
    color: #fff;
}

.site-header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-left: auto;
}

.sync-all-btn {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    min-width: 200px;
    max-width: min(320px, 100%);
    padding: 0;
    border-radius: 10px;
    background: #566696;
    border: 1px solid rgba(255, 255, 255, 0.28);
    color: #fff;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    overflow: hidden;
    text-align: left;
    box-shadow: rgba(0, 0, 0, 0.12) 0 2px 6px;
    transition: background 0.2s, border-color 0.2s, transform 0.2s, opacity 0.2s, min-width 0.2s;
}

.sync-all-btn__main {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
}

.sync-all-btn__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.sync-all-btn__label {
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sync-all-btn__meta {
    display: none;
    align-items: center;
    gap: 8px;
    font-size: 0.7rem;
    font-weight: 650;
    letter-spacing: 0.02em;
    opacity: 0.92;
    line-height: 1.2;
}

.sync-all-btn__meta[hidden] {
    display: none !important;
}

.sync-all-btn.is-working .sync-all-btn__meta {
    display: inline-flex;
}

.sync-all-btn__track {
    display: block;
    height: 0;
    background: rgba(0, 0, 0, 0.2);
    overflow: hidden;
    transition: height 0.2s ease;
}

.sync-all-btn.is-working .sync-all-btn__track {
    height: 4px;
}

.sync-all-btn__fill {
    display: block;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #33b1e8, #ebfaf2);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.35);
    transition: width 0.35s ease;
}

.sync-all-btn:hover:not(:disabled) {
    background: #7181af;
    border-color: rgba(255, 255, 255, 0.45);
    transform: translateY(-1px);
}

.sync-all-btn:disabled,
.sync-all-btn.is-working {
    cursor: wait;
    transform: none;
    opacity: 1;
}

.sync-all-btn.is-working {
    min-width: 240px;
    background: #566696;
}

.sync-all-btn.is-working > .sync-all-btn__main > svg {
    animation: osd-sync-spin 0.9s linear infinite;
    flex-shrink: 0;
}

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

.admin-dashboard-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.28);
    color: #fff;
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: rgba(0, 0, 0, 0.12) 0 2px 6px;
    transition: background 0.2s, border-color 0.2s, transform 0.2s;
}

.admin-dashboard-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.45);
    color: #fff;
    transform: translateY(-1px);
}

.admin-dashboard-btn--form {
    background: #566696;
    border: 0;
    border-radius: 4px;
    padding: 8px 14px;
    min-height: 40px;
    font-size: 16px;
    font-weight: 500;
    box-shadow: none;
}

.admin-dashboard-btn--form:hover {
    background: #7181af;
    border-color: transparent;
    color: #fff;
    transform: none;
}

/* Sync progress + result modal */
.sync-result-modal {
    position: fixed;
    inset: 0;
    z-index: 4000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.sync-result-modal[hidden] {
    display: none !important;
}

.sync-result-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(26, 36, 28, 0.55);
    backdrop-filter: blur(2px);
}

.sync-result-modal__box {
    position: relative;
    width: min(520px, 100%);
    max-height: min(86vh, 720px);
    overflow: auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 48px rgba(30, 63, 40, 0.28);
    padding: 28px 28px 24px;
    text-align: center;
    animation: osd-sync-modal-in 0.22s ease;
}

@keyframes osd-sync-modal-in {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.sync-result-modal__stats {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 0 0 18px;
}

.sync-result-modal__stat {
    min-width: 88px;
    padding: 8px 12px;
    border-radius: 10px;
    background: #ebfaf2;
    border: 1px solid #8fd6b0;
}

.sync-result-modal__stat-value {
    display: block;
    font-size: 1.125rem;
    font-weight: 700;
    color: #0077b3;
    line-height: 1.2;
}

.sync-result-modal__stat-label {
    display: block;
    margin-top: 2px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #454444ed;
}

.sync-result-modal__icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sync-result-modal__icon.is-success {
    background: rgba(0, 158, 226, 0.12);
    color: #009ee2;
}

.sync-result-modal__icon.is-partial {
    background: rgba(201, 146, 42, 0.16);
    color: #9a6f12;
}

.sync-result-modal__icon.is-error {
    background: rgba(176, 60, 52, 0.12);
    color: #a33a32;
}

.sync-result-modal__icon svg {
    width: 28px;
    height: 28px;
}

.sync-result-modal__title {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 1.35rem;
    font-weight: 700;
    color: #0077b3;
    margin: 0 0 8px;
}

.sync-result-modal__summary {
    color: #454444ed;
    font-size: 0.9375rem;
    line-height: 1.45;
    margin: 0 0 18px;
}

.sync-result-modal__steps {
    list-style: none;
    margin: 0 0 22px;
    padding: 0;
    text-align: left;
    border: 1px solid #8fd6b0;
    border-radius: 12px;
    overflow: hidden;
    background: #ebfaf2;
}

.sync-result-modal__step {
    padding: 12px 14px;
    border-bottom: 1px solid #8fd6b0;
}

.sync-result-modal__step:last-child {
    border-bottom: none;
}

.sync-result-modal__step-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 4px;
}

.sync-result-modal__step-label {
    font-weight: 650;
    color: #0077b3;
    font-size: 0.9375rem;
}

.sync-result-modal__badge {
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 3px 8px;
    border-radius: 999px;
}

.sync-result-modal__badge.is-ok {
    background: rgba(0, 158, 226, 0.12);
    color: #009ee2;
}

.sync-result-modal__badge.is-fail {
    background: rgba(176, 60, 52, 0.12);
    color: #a33a32;
}

.sync-result-modal__step-msg {
    margin: 0;
    color: #454444ed;
    font-size: 0.8125rem;
    line-height: 1.4;
    word-break: break-word;
}

.sync-result-modal__ok {
    appearance: none;
    border: none;
    border-radius: 10px;
    background: #566696;
    color: #fff;
    font: inherit;
    font-weight: 650;
    font-size: 0.9375rem;
    padding: 11px 28px;
    cursor: pointer;
    min-width: 120px;
}

.sync-result-modal__ok:hover {
    background: #7181af;
}

.form-page--with-header {
    padding-top: 32px;
}

.osd-form-shell--index .form-page--with-header {
    padding-top: 20px;
}

.form-page--with-header .bgSquare {
    top: 120px;
}

:root {
    /* Original OSD PHP palette */
    --primary: #009ee2;
    --primary-dark: #0077b3;
    --primary-light: #33b1e8;
    --accent: #566696;
    --accent-mid: #7181af;
    --text: #000000;
    --text-muted: #454444ed;
    --border: #8fd6b0;
    --white: #ffffff;
    --bg: #ebfaf2;
    --input-border: #8fd6b0;
    --input-border-hover: #6fc99a;
    --input-bg: var(--white);
    --input-bg-locked: #f7fdf9;
    --input-ring: rgba(143, 214, 176, 0.45);
}

.form-page {
    min-height: 100vh;
    position: relative;
    padding: 50px 16px 48px;
    background-color: #ebfaf2;
    z-index: 1;
}

.form-bg {
    display: none;
}

.bgSquare {
    background: #009ee2;
    height: 680px;
    width: 70%;
    position: absolute;
    z-index: 0;
    top: 155px;
    left: 0;
    right: 0;
    transform: skewY(-11deg);
    margin: 0 auto;
}

.form-wrapper {
    position: relative;
    z-index: 1;
    max-width: 720px;
    margin: 0 auto;
}

.form-wrapper-wide {
    max-width: 960px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #009ee2;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9375rem;
    margin-bottom: 16px;
}

.back-link:hover {
    color: #0077b3;
}

.form-card {
    background: #fff;
    border: 0;
    border-radius: 4px;
    padding: 30px;
    box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
}

.form-header {
    text-align: center;
    margin-bottom: 28px;
    position: relative;
}

.form-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.form-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-left: auto;
}

.form-today-count {
    font-size: 0.9rem;
    color: #000;
    font-weight: 500;
}

.form-today-count strong {
    color: #009ee2;
}

.btn-form-close {
    border: 0;
    background: #566696;
    color: #fff;
    font-weight: 500;
    font-size: 16px;
    border-radius: 4px;
    padding: 8px 14px;
    min-height: 40px;
    cursor: pointer;
}

.btn-form-close:hover {
    background: #566696;
    color: #fff;
}

.form-header .company-logo {
    width: 250px;
    height: auto;
    margin: 0 auto 12px;
    display: block;
}

.form-header .company-name {
    color: #000;
    font-weight: 500;
    font-size: 0.9375rem;
    margin-bottom: 8px;
}

.form-header h1 {
    font-size: 1.5rem;
    color: #000;
    padding-bottom: 10px;
    margin-bottom: 6px;
}

.form-subtitle {
    color: #000;
    font-size: 0.9375rem;
}

.form-placeholder-note {
    text-align: center;
    padding: 24px 16px;
    background: #ebfaf2;
    border: 1px dashed #8fd6b0;
    border-radius: 4px;
    color: #000;
    font-size: 0.9375rem;
    line-height: 1.55;
}

.form-placeholder-note strong {
    color: #009ee2;
}

.required {
    color: red;
}

.form-card label,
.form-label {
    color: #000;
    font-size: 16px;
    font-weight: 500;
    padding-bottom: 6px;
}

.form-control,
.form-select {
    background-color: #fff;
    font-size: 16px;
    color: #000;
    font-weight: 400;
    border: 1px solid #8fd6b0;
    height: 40px;
}

.form-control:focus,
.form-select:focus {
    box-shadow: none;
    border-color: #8fd6b0;
    background-color: #fff;
    outline: none;
}

.form-control.danger,
.form-select.danger,
.select2-container .select2-selection.danger {
    border: 1px solid red !important;
    background-color: #fff !important;
}

.osd-field-error,
.alert-danger {
    display: block;
    margin-top: 6px;
    color: red !important;
    font-size: 14px;
    font-weight: 500;
}

.form-tabel td .osd-field-error {
    text-align: left;
    white-space: normal;
    line-height: 1.3;
}

.form-tabel td .osd-field-error--checkbox {
    margin-top: 8px;
}

.osd-equipment-check-error .osd-field-error--section,
.osd-accident-outcome-error .osd-field-error--section,
.osd-section-error .osd-field-error--section {
    margin-top: 0;
    margin-bottom: 12px;
}

.osd-name-hint {
    display: block;
    margin-top: 6px;
    color: #566696;
    font-size: 13px;
}

.form-control:disabled,
.form-select:disabled,
.form-control[readonly]:not(.datepicker) {
    background-color: #fff;
    color: #000;
    cursor: not-allowed;
    opacity: 1;
}

.form-card h3,
.form-card h4 {
    color: #009ee2;
}

.form-card .btn-primary,
.form-card .btn:focus {
    background-color: #566696;
    border: 0;
    font-weight: 500;
    font-size: 16px;
    height: 40px;
    line-height: 20px;
    color: #fff;
    outline: 0 !important;
    box-shadow: none !important;
}

.form-card .btn-primary:hover,
.form-card .btn:active,
.form-card .btn:hover {
    background-color: #566696;
    border: 0;
    color: #fff;
}

.form-card .btn-submit {
    width: 100% !important;
    display: block;
    background-color: #566696 !important;
    border: 0 !important;
    border-radius: 4px;
    font-weight: 500;
    font-size: 16px;
    min-height: 40px;
    line-height: 20px;
    color: #fff !important;
    margin-top: 1rem;
    padding: 10px 16px;
    box-shadow: none !important;
}

.form-card .btn-submit:hover:not(:disabled),
.form-card .btn-submit:focus:not(:disabled),
.form-card .btn-submit:active:not(:disabled) {
    background-color: #566696 !important;
    border: 0 !important;
    color: #fff !important;
}

.form-card .btn-submit:disabled {
    background-color: #566696 !important;
    border: 0 !important;
    color: #fff !important;
    opacity: 0.65;
    cursor: not-allowed;
}

.add-more {
    width: auto !important;
    float: right;
    background: #8fd6b0 !important;
    color: #454444ed !important;
}

.select2-container--default .select2-selection--single,
.select2-container .select2-selection--single {
    border: 1px solid #8fd6b0;
    background-color: #fff;
    height: 40px;
}

.select2-container--default.select2-container--disabled .select2-selection--single {
    background-color: #fff;
    cursor: not-allowed;
    opacity: 1;
}

.form-tabel {
    width: 100%;
    border: 1px solid #000;
}

.form-tabel tr:nth-child(even) {
    background-color: #f2f2f2;
}

.form-tabel thead {
    position: sticky;
    top: -1px;
    color: #fff;
    z-index: 9;
}

.form-tabel thead th {
    color: #fff !important;
}

.form-tabel thead tr:nth-child(1) {
    background-color: #566696 !important;
}

.form-tabel thead tr:nth-child(2) {
    background-color: #7181af !important;
}

@media only screen and (max-width: 776px) {
    .form-card {
        padding: 10px;
    }

    .bgSquare {
        display: none;
    }

    .form-header .company-logo {
        width: 180px;
    }
}

@media only screen and (max-width: 576px) {
    .form-page {
        padding: 10px 8px;
    }

    .form-page--with-header {
        padding-top: 16px;
    }

    .osd-form-shell--index .form-page--with-header {
        padding-top: 12px;
        padding-bottom: 16px;
    }

    .site-header-inner {
        padding: 0 16px;
    }

    .site-header-logo {
        width: 130px;
    }

    .form-toolbar-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .admin-dashboard-btn--form,
    .btn-form-close {
        flex: 1 1 auto;
    }
}
