* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #0d1117;
    color: #e6edf3;
    font-family:
        Arial,
        Helvetica,
        sans-serif;
}

header {
    min-height: 64px;
    background: #161b22;
    border-bottom: 1px solid #30363d;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;

    padding: 8px 20px;

    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo {
    font-size: 20px;
    font-weight: 700;
}

.logo span {
    color: #00d639;
}

.header-right {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    align-items: center;
}

.status {
    padding: 7px 12px;
    border-radius: 20px;
    font-size: 13px;
    background: #21262d;
}

.status.ok {
    color: #3fb950;
}

.status.bad {
    color: #f85149;
}

button {
    border: 0;
    border-radius: 7px;
    padding: 9px 13px;
    cursor: pointer;
    background: #238636;
    color: white;
    font-weight: 600;
}

button:hover {
    filter: brightness(1.15);
}

button.secondary {
    background: #30363d;
}

button.danger {
    background: #da3633;
}

.container {
    padding: 15px;

    display: grid;

    grid-template-columns:
        minmax(0, 2fr)
        minmax(350px, 1fr);

    gap: 15px;
}

.card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 10px;
    overflow: hidden;
}

.card-title {
    padding: 12px 15px;

    font-weight: 700;

    border-bottom: 1px solid #30363d;

    display: flex;
    justify-content: space-between;
    align-items: center;
}

#map {
    height: 620px;
    width: 100%;
}

.info-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));
}

.info {
    padding: 12px 15px;

    border-bottom: 1px solid #21262d;
}

.label {
    color: #8b949e;
    font-size: 12px;
    margin-bottom: 5px;
}

.value {
    font-size: 15px;
    font-weight: 600;
}

.green {
    color: #3fb950;
}

.yellow {
    color: #d29922;
}

.red {
    color: #f85149;
}

.blue {
    color: #58a6ff;
}

.order-main {
    padding: 15px;
}

.order-code {
    font-size: 20px;
    font-weight: bold;
}

.badge {
    display: inline-block;

    margin-top: 6px;

    padding: 5px 9px;

    border-radius: 15px;

    background: #21262d;

    font-size: 12px;
}

.steps {
    max-height: 440px;
    overflow-y: auto;
}

.step {
    padding: 12px 15px;

    border-bottom: 1px solid #21262d;

    display: grid;

    grid-template-columns: 34px 1fr auto;

    gap: 10px;

    align-items: center;
}

.step-number {
    width: 28px;
    height: 28px;

    border-radius: 50%;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #30363d;

    font-size: 12px;
    font-weight: bold;
}

.step.completed .step-number {
    background: #238636;
}

.step.active .step-number {
    background: #d29922;
}

.step.driver-accepted .step-number {
    background: #1f6feb;
}

.step-type {
    font-size: 12px;
    color: #8b949e;
}

.step-code {
    font-size: 13px;
    margin-top: 3px;
}

.step-coord {
    font-size: 11px;
    color: #8b949e;
    margin-top: 4px;
}

.step-state {
    font-size: 11px;
    text-align: right;
}

.alert-box {
    margin: 15px;

    padding: 15px;

    border: 1px solid #30363d;
    border-radius: 9px;

    background: #0d1117;
}

.distance {
    font-size: 34px;
    font-weight: bold;

    margin: 8px 0;
}

.alert-normal {
    border-color: #238636;
}

.alert-warning {
    border-color: #d29922;

    animation: pulseYellow 1.5s infinite;
}

.alert-danger {
    border-color: #f85149;

    animation: pulseRed .7s infinite;
}

@keyframes pulseYellow {
    50% {
        background: #2b210b;
    }
}

@keyframes pulseRed {
    50% {
        background: #3b1111;
    }
}

.controls {
    padding: 15px;

    display: flex;

    flex-wrap: wrap;

    gap: 8px;
}

.slider-row {
    padding: 0 15px 15px;
}

input[type=range] {
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
}

td {
    padding: 8px 15px;

    border-bottom: 1px solid #21262d;

    font-size: 13px;
}

td:first-child {
    color: #8b949e;
    width: 45%;
}

footer {
    color: #8b949e;
    font-size: 11px;
    padding: 10px 15px;
}

.order-form {
    display: flex;
    gap: 8px;
    padding: 15px;
}

.order-form input {
    flex: 1;
    min-width: 0;
    background: #0d1117;
    color: #e6edf3;
    border: 1px solid #30363d;
    border-radius: 7px;
    padding: 9px 12px;
}

.order-error {
    color: #f85149;
    font-size: 13px;
    padding: 0 15px 12px;
}

.order-list {
    max-height: 520px;
    overflow: auto;
}

.order-empty {
    color: #8b949e;
    padding: 16px 15px;
}

.order-item {
    padding: 12px 15px;
    border-bottom: 1px solid #21262d;
    border-left: 4px solid var(--order-color, #30363d);
}

.order-item.arriving {
    background: #2b210b;
}

.order-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
}

.order-meta,
.muted {
    color: #8b949e;
    font-size: 12px;
    margin-top: 4px;
}

.status-badge {
    display: inline-block;
    margin-top: 6px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.status-badge.delivering {
    background: #3d2a00;
    color: #d29922;
}

.status-badge.prepare {
    background: #0d2847;
    color: #58a6ff;
}

.status-badge.done {
    background: #0f2a16;
    color: #3fb950;
}

.status-badge.bad {
    background: #3d1214;
    color: #f85149;
}

.status-badge.wait {
    background: #21262d;
    color: #8b949e;
}

.pin-wrap,
.driver-pin-wrap {
    background: transparent;
    border: 0;
}

.driver-pin {
    width: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.driver-pin img,
.driver-fallback {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--pin, #fff);
    background: #161b22;
}

.driver-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
}

.driver-bike {
    margin-top: -8px;
    font-size: 16px;
    line-height: 1;
}

.driver-name {
    max-width: 140px;
    margin-top: 2px;
    padding: 1px 5px;
    border-radius: 6px;
    background: #0d1117;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pin {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .45);
}

.pin.drop {
    border-radius: 4px;
}

.sub-pick {
    width: 14px;
    height: 14px;
    box-sizing: border-box;
    border: 2px solid #fff;
    background: transparent;
}

.sub-drop {
    display: block;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .45));
}

.suborders {
    margin-top: 8px;
}

.suborder {
    margin-top: 6px;
    padding: 6px 8px;
    border-radius: 6px;
    background: #0d1117;
}

.suborder b {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.sub-swatch {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.sub-step {
    margin-top: 2px;
    font-size: 12px;
    color: #c9d1d9;
}

.sub-step.done {
    color: #8b949e;
}

.sub-step.active {
    color: #d29922;
    font-weight: 700;
}

@media(max-width: 900px) {

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

    #map {
        height: 500px;
    }
}
