* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, sans-serif;
    background: #eef2f6;
    color: #17212b;
}

button {
    font: inherit;
}

[hidden] {
    display: none !important;
}

.content {
    min-height: 100vh;
    padding: 64px 16px 16px;
}

.mobile-login {
    width: min(100%, 520px);
    min-height: calc(100vh - 80px);
    margin: 0 auto;
    display: grid;
    align-items: start;
}

.login-panel {
    display: grid;
    gap: 16px;
    padding: 18px;
    border: 1px solid #d7e0e9;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 18px 38px rgba(76, 88, 98, 0.14);
}

.login-panel h1 {
    font-size: 30px;
}

.login-form {
    display: grid;
    gap: 8px;
}

.login-form input {
    width: 100%;
    min-height: 48px;
    padding: 10px 12px;
    border: 1px solid #cfd8e3;
    border-radius: 7px;
    background: #fff;
    color: #17212b;
    font-size: 16px;
}

.login-form .small-action {
    width: 100%;
    min-height: 50px;
    margin-top: 6px;
}

.login-message {
    min-height: 20px;
    color: #bb3b3b;
    font-size: 14px;
    font-weight: 700;
}

.mobile-home {
    width: min(100%, 520px);
    min-height: calc(100vh - 80px);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.app-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 10px;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logout-button {
    min-height: 36px;
    padding: 7px 10px;
    border: 1px solid #cfd8e3;
    border-radius: 7px;
    background: #fff;
    color: #435266;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.eyebrow {
    margin: 0 0 3px;
    color: #607086;
    font-size: 13px;
    font-weight: 700;
}

h1 {
    margin: 0;
    font-size: 28px;
    letter-spacing: 0;
}

.status-pill {
    min-width: 92px;
    padding: 8px 10px;
    border-radius: 999px;
    background: #dce4ec;
    color: #435266;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
}

.mobile-home.is-logging .status-pill {
    background: #dff5e9;
    color: #16653b;
}

.primary-toggle {
    width: min(78vw, 280px);
    aspect-ratio: 1;
    min-height: 220px;
    margin: 8px auto 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 8px solid rgba(255, 255, 255, 0.88);
    border-radius: 999px;
    background: #7f8c8d;
    color: #fff;
    box-shadow: 0 18px 38px rgba(76, 88, 98, 0.22), inset 0 0 0 1px rgba(255, 255, 255, 0.18);
    cursor: pointer;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.primary-toggle span {
    font-size: 58px;
    font-weight: 800;
    line-height: 1;
}

.primary-toggle strong {
    max-width: 190px;
    font-size: 26px;
    font-weight: 800;
    line-height: 1.08;
}

.primary-toggle small {
    font-size: 15px;
    font-weight: 700;
    opacity: 0.9;
}

.primary-toggle:disabled {
    cursor: wait;
    opacity: 0.72;
}

.primary-toggle.is-holding {
    transform: scale(0.96);
    box-shadow: 0 10px 24px rgba(76, 88, 98, 0.3), inset 0 0 0 999px rgba(255, 255, 255, 0.12);
}

.mobile-home.is-work .primary-toggle {
    background: #27ae60;
    box-shadow: 0 18px 36px rgba(39, 174, 96, 0.22);
}

.mobile-home.is-personal .primary-toggle {
    background: #1769aa;
    box-shadow: 0 18px 36px rgba(23, 105, 170, 0.22);
}

.mobile-home.is-logging .primary-toggle.is-holding {
    background: #bb3b3b;
    box-shadow: 0 10px 24px rgba(187, 59, 59, 0.28), inset 0 0 0 999px rgba(255, 255, 255, 0.12);
}

.status-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    overflow: hidden;
    border: 1px solid #d7e0e9;
    border-radius: 8px;
    background: #d7e0e9;
}

.status-card > div,
.info-card {
    background: #fff;
    padding: 14px;
}

label {
    display: block;
    margin-bottom: 6px;
    color: #607086;
    font-size: 13px;
    font-weight: 700;
}

.status-card strong {
    display: block;
    min-height: 24px;
    font-size: 18px;
}

.info-card {
    border: 1px solid #d7e0e9;
    border-radius: 8px;
    line-height: 1.35;
}

#locationBox,
#monthReportBox {
    color: #253244;
    font-size: 15px;
}

.vehicle-picker-card select {
    width: 100%;
    min-height: 44px;
    padding: 9px 10px;
    border: 1px solid #cfd8e3;
    border-radius: 7px;
    background: #fff;
    color: #17212b;
    font-size: 16px;
}

.reminder-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.reminder-row > div {
    min-width: 0;
}

#reminderStatus {
    color: #253244;
    font-size: 15px;
    line-height: 1.35;
}

.report-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0;
}

.report-row + .report-row {
    border-top: 1px solid #edf1f5;
}

.report-row span {
    color: #607086;
}

.admin-page {
    width: min(100%, 960px);
    margin: 0 auto;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.admin-table-wrap {
    overflow-x: auto;
    border: 1px solid #d7e0e9;
    border-radius: 8px;
    background: #fff;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 640px;
}

.admin-table th,
.admin-table td {
    padding: 12px;
    border-bottom: 1px solid #edf1f5;
    text-align: left;
    vertical-align: top;
}

.admin-table th {
    color: #607086;
    font-size: 13px;
}

.role-pill {
    display: inline-block;
    margin: 0 6px 6px 0;
    padding: 4px 8px;
    border-radius: 999px;
    background: #e8f1fb;
    color: #1769aa;
    font-size: 13px;
    font-weight: 700;
}

.muted {
    color: #7a8796;
}

.small-action {
    min-height: 38px;
    padding: 8px 12px;
    border: 0;
    border-radius: 7px;
    background: #1769aa;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.small-action.secondary {
    background: #e8edf3;
    color: #253244;
}

.drive-log-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.drive-editor {
    margin-bottom: 14px;
    padding: 14px;
    border: 1px solid #d7e0e9;
    border-radius: 8px;
    background: #fff;
}

.merge-panel {
    margin-top: 14px;
    margin-bottom: 14px;
    padding: 14px;
    border: 1px solid #d7e0e9;
    border-radius: 8px;
    background: #fff;
}

.merge-panel .drive-card {
    background: #f9fbfd;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2500;
    display: grid;
    place-items: end center;
    padding: 14px;
    background: rgba(15, 24, 34, 0.48);
}

.modal-backdrop[hidden] {
    display: none;
}

.report-modal {
    width: min(100%, 560px);
    max-height: min(92vh, 760px);
    overflow: auto;
    padding: 14px;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 18px 48px rgba(15, 24, 34, 0.28);
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 6px;
}

.checkbox-grid label {
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 8px 10px;
    border: 1px solid #cfd8e3;
    border-radius: 7px;
    color: #253244;
    background: #fff;
}

.checkbox-grid input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: #1769aa;
}

.editor-header,
.editor-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.editor-header {
    margin-bottom: 12px;
}

.editor-header h2 {
    margin: 0;
}

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

.editor-grid label {
    margin: 0;
}

.editor-grid .wide {
    grid-column: 1 / -1;
}

.editor-grid input,
.editor-grid select {
    width: 100%;
    min-height: 42px;
    margin-top: 5px;
    padding: 9px 10px;
    border: 1px solid #cfd8e3;
    border-radius: 7px;
    background: #fff;
    color: #17212b;
    font-size: 15px;
}

.editor-actions {
    margin-top: 12px;
    justify-content: flex-start;
}

.drive-type-rocker {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    margin-bottom: 12px;
    padding: 4px;
    border: 1px solid #cfd8e3;
    border-radius: 8px;
    background: #eef2f6;
}

.drive-type-rocker button {
    min-height: 44px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #435266;
    font-weight: 800;
    cursor: pointer;
}

.drive-type-rocker button.active {
    background: #17212b;
    color: #fff;
}

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

.drive-card {
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid #d7e0e9;
    border-radius: 8px;
    background: #fff;
}

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

.drive-card-tools {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.select-drive {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    color: #435266;
    font-size: 13px;
    font-weight: 700;
}

.select-drive input {
    width: 18px;
    height: 18px;
    accent-color: #1769aa;
}

.drive-card-top strong,
.drive-card-top span {
    display: block;
}

.drive-card-top span {
    margin-top: 3px;
    color: #7a8796;
    font-size: 13px;
}

.drive-card-distance {
    font-size: 28px;
    font-weight: 800;
}

.drive-card-address label {
    margin-bottom: 3px;
}

.drive-card-address div {
    color: #253244;
    font-size: 14px;
    line-height: 1.35;
}

.route-card-list {
    margin-bottom: 14px;
}

.route-card {
    border-color: #cbd8e4;
}

.route-source {
    color: #7a8796;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.route-stops {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.route-stops li {
    display: grid;
    grid-template-columns: 82px 1fr;
    gap: 3px 10px;
    padding: 9px 0;
    border-top: 1px solid #edf1f5;
}

.route-stops li:first-child {
    border-top: 0;
}

.route-stops span {
    color: #607086;
    font-size: 12px;
    font-weight: 800;
}

.route-stops strong {
    color: #253244;
    font-size: 14px;
    line-height: 1.35;
}

.route-stops small {
    grid-column: 2;
    color: #7a8796;
    font-size: 12px;
}

.datetime-box {
    display: none;
}

.hamburger {
    position: fixed;
    top: 12px;
    left: 16px;
    z-index: 2000;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 8px 20px rgba(23, 33, 43, 0.12);
    font-size: 24px;
    cursor: pointer;
    user-select: none;
}

.side-menu {
    position: fixed;
    top: 0;
    left: -260px;
    z-index: 1999;
    width: 240px;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 64px;
    background: #17212b;
    transition: left 0.25s ease;
}

.side-menu a {
    color: #fff;
    text-decoration: none;
    padding: 13px 20px;
    font-size: 17px;
}

.side-menu a:hover {
    background: rgba(255, 255, 255, 0.08);
}

.menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 1500;
    display: none;
    background: rgba(15, 24, 34, 0.45);
}

.navbar {
    display: none !important;
}

@media (min-width: 720px) {
    .content {
        padding: 28px;
    }

    .mobile-home {
        min-height: calc(100vh - 56px);
    }

    .mobile-login {
        min-height: calc(100vh - 56px);
        align-items: center;
    }
}

@media (max-width: 380px) {
    .primary-toggle {
        min-height: 190px;
    }

    .primary-toggle span {
        font-size: 25px;
    }

    .status-card {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .editor-grid {
        grid-template-columns: 1fr;
    }

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

    .admin-table {
        min-width: 760px;
    }
}
