h1,
h2,
h3,
h4,
h5,
h6 {
    margin-top: 0.2em;
    margin-bottom: 0.2em;
    line-height: 1.15;
}

h2 {
    font-size: 16px;
}

h3 {
    font-size: 14px;
}

.cell h2,
.cell h3,
.nested-cell h3 {
    margin-top: 0.2em !important;
    margin-bottom: 0.2em !important;
}

.estimate-item h3 {
    min-height: 0 !important;
    line-height: 1.15;
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
    border-radius: 12px !important;
}

.container form input[type="text"],
.container form input[type="number"],
.container form input[type="email"],
.container form input[type="input"],
.container form select {
    min-height: 42px;
    width: 100%;
    padding: 10px 12px;
}

.container form .padding5x,
.container form .datetime-item,
.container form .estimate-item {
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.container form .flex {
    gap: 12px;
}

.container form .flex > .padding5x,
.container form .flex > .flex {
    flex: 1 1 0;
    min-width: 0;
}

.container form .padding5x,
.container form .blockdisplay.padding10x {
    padding: 10px 12px !important;
    margin: 6px 0;
    width: 100%;
    box-sizing: border-box;
    border-radius: 8px;
    background: #f8fafd;
    border: 1px solid #d1d9e6;
}

#requestingpartyandactivitywrapper .padding5x:has(> h2),
#requestingpartyandactivitywrapper .blockdisplay.padding10x:has(> h2) {
    padding-top: 10px !important;
}

.container form .padding5x > h2,
.container form .blockdisplay.padding10x > h2 {
    margin: 0 0 8px !important;
}

#requestingpartyandactivitywrapper {
    margin-bottom: 14px;
}

#dateandtime {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 6px;
}

#dateandtime > h2,
.section-card > h2,
.section-card .grid-two > div > h2 {
    margin: 0 0 10px;
}

.section-card > h2.marginbottom0 {
    margin: 0;
}

#dateandtime .cell {
    margin: 0;
    padding: 0;
}

#dateandtime .datetime-row {
    display: grid !important;
    grid-template-columns: minmax(220px, 1.4fr) minmax(180px, 1fr) minmax(
            180px,
            1fr
        );
    gap: 12px;
    width: 100%;
    align-items: stretch;
}

#dateandtime .estimate-row {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 12px;
    width: 100%;
    align-items: stretch;
}

#dateandtime .datetime-item,
#dateandtime .estimate-item {
    display: flex;
    flex-direction: column;
    align-items: stretch !important;
    justify-content: flex-start;
    height: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    background: #f8fafd;
    border: 1px solid #d1d9e6;
}

#dateandtime .datetime-item h3,
#dateandtime .estimate-item h3 {
    margin: 0 0 8px !important;
    text-align: left;
    min-height: 0 !important;
}

#dateandtime .datetime-item input,
#dateandtime .estimate-item input {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 42px;
    text-align: center;
}

#dateandtime .smallspan {
    text-align: left;
    margin-top: 6px;
    display: block;
}

.route-manager {
    margin: 6px 0 14px;
    background: #f0f4fa;
    border: 1px solid #d1d9e6;
    border-radius: 10px;
    padding: 14px;
}

.route-manager.disabled {
    opacity: 0.6;
    border-style: dashed;
}

.route-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.route-toolbar-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.route-toolbar-label {
    color: #374151;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.route-lock-hint {
    margin-top: 2px;
    margin-bottom: 10px;
    color: #1d4ed8;
    font-size: 12px;
    line-height: 1.3;
}

.route-label-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 0;
    font-size: 12px;
    color: #374151;
    font-weight: 600;
}

.route-label-toggle input[type="checkbox"] {
    accent-color: #22d3ee;
    width: 14px;
    height: 14px;
}

.route-lock-hint.hidden {
    display: none;
}

#addRouteBtn.route-add-btn {
    border: 1px solid rgba(125, 211, 252, 0.55);
    color: #e0f2fe;
    background: linear-gradient(
        135deg,
        rgba(3, 105, 161, 0.9),
        rgba(14, 116, 144, 0.9)
    );
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition:
        transform 0.15s ease,
        box-shadow 0.2s ease;
    box-shadow: 0 8px 18px rgba(14, 116, 144, 0.35);
}

#addRouteBtn.route-add-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(14, 116, 144, 0.45);
}

#addRouteBtn.route-add-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#routeList.route-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.route-empty {
    color: #6b7280;
    font-size: 13px;
    background: #f8fafd;
    border: 1px dashed #c5d0e0;
    border-radius: 10px;
    padding: 10px 12px;
}

.route-item {
    display: grid;
    grid-template-columns: auto auto minmax(120px, 1fr) auto auto;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    border: 1px solid #d1d9e6;
    border-radius: 8px;
    padding: 8px;
}

.route-item.active {
    border-color: rgba(96, 165, 250, 0.9);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}

.route-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    display: inline-block;
}

.route-badge {
    color: #6b7280;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.route-name-input {
    width: 100%;
    border-radius: 8px;
    border: 1px solid #d1d9e6;
    background: #ffffff;
    color: #1a2238;
    padding: 7px 10px;
    font-size: 13px;
    outline: none;
}

.route-name-input:focus {
    border-color: rgba(56, 189, 248, 0.9);
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.route-action-btn {
    border-radius: 8px;
    border: 1px solid #d1d9e6;
    background: #f0f4fa;
    color: #374151;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.route-action-btn.emoji {
    min-width: 34px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-size: 15px;
}

.route-action-btn:disabled {
    opacity: 0.7;
    cursor: default;
}

.route-action-btn.remove {
    border-color: rgba(248, 113, 113, 0.45);
    color: #fecaca;
    background: rgba(127, 29, 29, 0.35);
}

.route-endpoint-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
}

#drawHelp {
    position: absolute !important;
    top: 88px;
    left: 54px;
    height: auto !important;
    min-height: 0;
    max-height: none;
    padding: 4px 10px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.1;
    display: flex;
    align-items: center;
    overflow: hidden;
}

#drawHelp h4 {
    margin: 0 0 0 8px;
    display: block;
    font-size: 13px;
    line-height: 1.2;
    white-space: nowrap;
}

#drawHelp::after {
    top: 50%;
    transform: translateY(-50%);
    border-width: 6px;
}

#adminLinkWrapper {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    transition:
        opacity 0.3s ease,
        transform 0.3s ease;
}

#adminLinkWrapper a {
    background: linear-gradient(135deg, #0038a8 0%, #0056d2 100%);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    display: inline-block;
    box-shadow: 0 4px 12px rgba(0, 56, 168, 0.3);
}

#adminLinkWrapper a:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 56, 168, 0.4);
}

#mmdaBadge {
    transition:
        opacity 0.3s ease,
        transform 0.3s ease;
}

#other-input-container {
    display: none;
    margin-top: 15px;
}

.route-draw-section {
    max-width: 100%;
    margin: 20px 0;
}

.route-draw-title {
    padding-bottom: 0;
    margin-bottom: 0;
}

#map {
    height: 400px;
    width: 100%;
}

#dropzone-error,
#signature-error,
#total-progress-container {
    display: none;
}

#my-dropzone {
    border: 2px dashed #ccc;
    border-radius: 8px;
}

#signature-pad {
    border: 1px solid #000000;
    min-height: 200px;
    display: block;
}

#total-progress-container {
    width: 100%;
    margin-bottom: 15px;
}

.total-progress-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #374151;
    margin-bottom: 5px;
}

.progress-bg {
    background: #e2e8f0;
    border-radius: 10px;
    height: 12px;
    overflow: hidden;
    border: 1px solid #d1d9e6;
}

#total-progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #0ea5e9, #22d3ee);
    transition: width 0.3s ease;
}

@media (max-width: 740px) {
    .route-item {
        grid-template-columns: auto minmax(120px, 1fr) auto auto;
    }

    .route-badge {
        display: none;
    }

    #drawHelp {
        top: 56px;
        left: 48px;
        padding: 5px 8px;
        font-size: 12px;
    }

    #drawHelp h4 {
        font-size: 12px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem 0.8rem !important;
    }

    #dateandtime .datetime-row,
    #dateandtime .estimate-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1024px), (pointer: coarse) {
    #mapWrapper ul.leaflet-draw-actions.leaflet-draw-actions-top,
    #mapWrapper ul.leaflet-draw-actions.leaflet-draw-actions-bottom,
    #mapWrapper
        ul.leaflet-draw-actions.leaflet-draw-actions-top.leaflet-draw-actions-bottom {
        left: 42px !important;
        right: auto !important;
        top: 0 !important;
        margin: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 4px !important;
        width: auto !important;
    }

    #mapWrapper .leaflet-draw-actions li {
        float: none !important;
        margin: 0 !important;
    }

    #mapWrapper .leaflet-draw-actions li a {
        width: auto !important;
        min-width: 0 !important;
        white-space: normal !important;
        line-height: 1.2 !important;
        height: auto !important;
        padding: 6px 8px !important;
        font-size: 11px !important;
        max-width: 140px !important;
    }
}
