:root {
    --app-blue: #205089;
    --app-blue-dark: #12365d;
    --app-blue-soft: #edf4fb;
    --app-ink: #152333;
    --app-muted: #6f7d8d;
    --app-line: #dce5ef;
    --app-surface: #ffffff;
    --app-bg: #eef3f8;
    --app-danger: #ae3434;
    --app-warning: #8a6400;
    --app-radius: 24px;
    --app-shadow:
        0 18px 50px rgba(27, 62, 98, .08),
        0 2px 8px rgba(27, 62, 98, .04);
}

html {
    background: var(--app-bg);
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100dvh;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 0 0, rgba(32, 80, 137, .12), transparent 34%),
        radial-gradient(circle at 100% 22%, rgba(91, 135, 181, .09), transparent 30%),
        var(--app-bg);
    color: var(--app-ink);
    -webkit-font-smoothing: antialiased;
}

button,
input {
    -webkit-tap-highlight-color: transparent;
}

button {
    touch-action: manipulation;
}

.page {
    min-height: 100dvh;
    display: block;
    padding:
        max(22px, env(safe-area-inset-top))
        16px
        max(34px, env(safe-area-inset-bottom));
}

.card {
    width: min(100%, 520px);
    max-width: none;
    margin: 0 auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

/* Brand header */
.card > .logo {
    width: 50px;
    height: 50px;
    margin: 0 0 13px;
    border-radius: 15px;
    background:
        linear-gradient(145deg, #2b64a1, var(--app-blue));
    box-shadow: 0 10px 25px rgba(32, 80, 137, .22);
    font-size: 24px;
}

.card > .eyebrow {
    margin-bottom: 22px;
    color: var(--app-blue);
    font-size: 11px;
    letter-spacing: .19em;
}

/* Device activation */
#activation-view {
    padding: 27px 22px 23px;
    border: 1px solid rgba(214, 225, 236, .95);
    border-radius: 28px;
    background: rgba(255, 255, 255, .95);
    box-shadow: var(--app-shadow);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

#activation-view h1 {
    max-width: 330px;
    font-size: clamp(29px, 9vw, 40px);
}

#activation-view .description {
    margin: 13px 0 27px;
    font-size: 16px;
    line-height: 1.55;
}

#activation-view label {
    color: #34465a;
    font-size: 13px;
}

#activation-code {
    height: 61px;
    border-color: #d5e0eb;
    border-radius: 16px;
    background: #f9fbfd;
    font-size: 22px;
}

#activation-code:focus {
    background: white;
}

#activation-button {
    min-height: 57px;
    margin-top: 15px;
    border-radius: 16px;
    background:
        linear-gradient(135deg, #285f9c, var(--app-blue));
    box-shadow: 0 12px 24px rgba(32, 80, 137, .20);
}

.security-note {
    padding: 15px 16px;
    border-radius: 15px;
    background: #f4f7fa;
    color: var(--app-muted);
}

/* Employee dashboard */
#employee-view:not([hidden]) {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr);
    column-gap: 14px;
    align-items: center;
}

#employee-view > .success-mark {
    grid-column: 1;
    grid-row: 1 / span 2;
    width: 54px;
    height: 54px;
    margin: 0;
    border: 1px solid #d4e3f2;
    background: var(--app-surface);
    box-shadow: 0 8px 20px rgba(32, 80, 137, .08);
    font-size: 25px;
}

#employee-view > .eyebrow {
    grid-column: 2;
    align-self: end;
    margin: 0 0 5px;
    font-size: 10px;
}

#employee-view > h1 {
    grid-column: 2;
    align-self: start;
    overflow-wrap: anywhere;
    font-size: clamp(27px, 8vw, 37px);
}

#employee-view > .description,
#employee-view > .status-box,
#employee-view > .payroll-section,
#employee-view > .mileage-section,
#employee-view > #logout-button {
    grid-column: 1 / -1;
}

#employee-view > .description {
    margin: 20px 0 14px;
    padding-left: 3px;
    color: var(--app-muted);
    font-size: 15px;
}

/* Attendance status */
.status-box {
    position: relative;
    min-height: 128px;
    margin: 0 0 14px;
    padding: 24px 22px;
    overflow: hidden;
    border: 0;
    border-radius: var(--app-radius);
    background:
        linear-gradient(145deg, #285f9c, var(--app-blue-dark));
    box-shadow: 0 18px 36px rgba(24, 60, 99, .18);
    color: white;
}

.status-box::after {
    content: "";
    position: absolute;
    width: 150px;
    height: 150px;
    top: -80px;
    right: -45px;
    border: 24px solid rgba(255, 255, 255, .08);
    border-radius: 50%;
}

.status-box strong,
.status-box span {
    position: relative;
    z-index: 1;
}

.status-box strong {
    font-size: 21px;
    letter-spacing: -.015em;
}

.status-box span {
    max-width: 350px;
    color: rgba(255, 255, 255, .78);
    font-size: 14px;
}

.status-box.processing {
    background: linear-gradient(145deg, #a67a0d, #795700);
    color: white;
}

.status-box.processing span {
    color: rgba(255, 255, 255, .78);
}

.status-box.success {
    border: 1px solid #cfe0f1;
    background: linear-gradient(145deg, #ffffff, #edf5fc);
    box-shadow: var(--app-shadow);
    color: var(--app-blue);
}

.status-box.success span {
    color: #526b84;
}

.status-box.error-state {
    border: 1px solid #f0d1cf;
    background: linear-gradient(145deg, #ffffff, #fff0ef);
    box-shadow: var(--app-shadow);
    color: var(--app-danger);
}

.status-box.error-state span {
    color: #895451;
}

/* Content cards */
.payroll-section,
.mileage-section {
    margin: 14px 0 0;
    padding: 21px;
    border: 1px solid var(--app-line);
    border-radius: var(--app-radius);
    background: var(--app-surface);
    box-shadow: var(--app-shadow);
    text-align: left;
}

.mileage-section {
    padding-top: 21px;
    border-top: 1px solid var(--app-line);
}

.payroll-heading,
.mileage-heading {
    margin-bottom: 18px;
}

.payroll-heading h2,
.mileage-heading h2 {
    color: var(--app-ink);
    font-size: 22px;
    letter-spacing: -.02em;
}

.payroll-heading .eyebrow,
.mileage-heading .eyebrow {
    margin-bottom: 5px;
    font-size: 10px;
}

.payroll-period,
.rate-badge {
    border: 1px solid #d7e5f3;
    background: var(--app-blue-soft);
    color: var(--app-blue);
}

.payroll-grid {
    gap: 9px;
}

.payroll-metric {
    min-height: 90px;
    padding: 14px;
    border-color: #e1e8f0;
    border-radius: 16px;
    background: #f9fbfd;
}

.payroll-metric span {
    color: var(--app-muted);
}

.payroll-metric strong {
    color: #193a5c;
    font-size: 19px;
}

.payroll-metric.accent {
    border-color: #c8daec;
    background:
        linear-gradient(145deg, #f4f9fd, #eaf3fb);
}

.mileage-section label {
    margin: 16px 0 7px;
    color: #405166;
    font-size: 13px;
}

.mileage-section input {
    height: 55px;
    border-color: #d9e2ec;
    border-radius: 15px;
    background: #f9fbfd;
}

.mileage-section input:focus {
    background: white;
}

.mileage-calculation {
    padding: 15px;
    border: 1px solid #e1e8f0;
    border-radius: 15px;
    background: #f5f8fb;
}

.mileage-entry {
    padding: 15px;
    border-color: #e0e7ef;
    border-radius: 16px;
    background: #fbfcfe;
}

.mileage-history-block {
    padding-top: 4px;
}

.mileage-history-block h3 {
    font-size: 17px;
}

/* Buttons */
#employee-view button,
#activation-view button {
    transition:
        transform .15s ease,
        box-shadow .15s ease,
        background .15s ease;
}

#employee-view button:active,
#activation-view button:active {
    transform: scale(.985);
}

#mileage-submit {
    min-height: 55px;
    border-radius: 16px;
    background:
        linear-gradient(135deg, #285f9c, var(--app-blue));
    box-shadow: 0 10px 22px rgba(32, 80, 137, .17);
}

#logout-button.secondary {
    min-height: 48px;
    margin: 18px 0 0;
    border: 0;
    background: transparent;
    color: #7c8794;
    font-size: 13px;
    font-weight: 650;
    box-shadow: none;
}

/* Messages */
.error,
.mileage-message {
    border-radius: 14px;
}

.payroll-updated {
    color: #8a95a2;
}

/* Desktop and larger phones */
@media (min-width: 600px) {
    .page {
        padding-top: max(42px, env(safe-area-inset-top));
    }

    #activation-view {
        padding: 36px;
    }

    .payroll-section,
    .mileage-section {
        padding: 25px;
    }
}

@media (max-width: 370px) {
    .page {
        padding-left: 12px;
        padding-right: 12px;
    }

    #activation-view,
    .payroll-section,
    .mileage-section {
        padding-left: 17px;
        padding-right: 17px;
    }

    .payroll-metric strong {
        font-size: 15px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition: none !important;
    }
}
