:root {
    --primary: #FF4D4D;
    --primary-dark: #D93636;
    --secondary: #4CAF50;
    --light: #F8F9FA;
    --dark: #212121;
    --gray: #757575;
    --border: #E0E0E0;
    --yandex: #FFCC00;
    --shadow: 0 2px 12px rgba(0,0,0,0.1);
    --radius: 12px;
    --header-height: 56px;
}
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Roboto', sans-serif; -webkit-tap-highlight-color: transparent; }
body { background: #05070b; color: var(--light); height: 100vh; overflow: hidden; }
.header {
    position: fixed; top: 0; left: 0; right: 0; height: var(--header-height);
    background: var(--dark); color: white; padding: 12px 16px; z-index: 1001;
    display: flex; justify-content: space-between; align-items: center; box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
.header-title { font-size: 1.1rem; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.header-actions { display: flex; gap: 10px; }
.header-btn {
    background: rgba(255,255,255,0.15); border: none; width: 40px; height: 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; color: white; font-size: 1.1rem; cursor: pointer;
}
.header-btn:active { background: rgba(255,255,255,0.25); transform: scale(0.95); }
.app-container { height: 100vh; padding-top: var(--header-height); position: relative; }
.input-screen {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top, #1b2538 0%, #05070b 55%, #000 100%);
    z-index: 1002;
    padding: 20px 16px 24px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
.input-screen.hidden { display: none; }
.input-card {
    background: rgba(9, 11, 19, 0.96);
    border-radius: 18px;
    padding: 20px 18px 18px;
    box-shadow: 0 18px 60px rgba(0,0,0,0.6);
    margin: auto;
    width: 100%;
    max-width: 560px;
    border: 1px solid rgba(255,255,255,0.06);
}
.input-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: #ffffff;
}
.input-subtitle {
    color: rgba(255,255,255,0.65);
    margin-bottom: 14px;
    line-height: 1.4;
    font-size: 0.9rem;
}
.input-subtitle span.hint {
    display: block;
    margin-top: 4px;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.45);
}
.input-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.input-row label {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.75);
}
.city-select {
    flex: 1;
    min-width: 140px;
    position: relative;
}
.city-select select {
    width: 100%;
    padding: 10px 32px 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.16);
    background: rgba(7, 9, 16, 0.95);
    color: #f3f4f8;
    font-size: 0.9rem;
    appearance: none;
    outline: none;
}
.city-select::after {
    content: "\f107";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8rem;
    color: rgba(255,255,255,0.6);
    pointer-events: none;
}
#messageInput {
    width: 100%;
    min-height: 32vh;
    max-height: 60vh;
    padding: 14px 14px 12px;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.5;
    resize: vertical;
    background: rgba(5, 8, 15, 0.95);
    color: #f3f4f8;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.7);
}
#messageInput::placeholder {
    color: rgba(255,255,255,0.35);
}
#messageInput:focus {
    outline: none;
    border-color: rgba(255, 77, 77, 0.9);
    box-shadow:
        0 0 0 1px rgba(255,77,77,0.8),
        0 0 25px rgba(255,77,77,0.35);
}
.btn {
    padding: 16px; border-radius: 10px; border: none; font-weight: 600; font-size: 1rem;
    display: flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer; width: 100%;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: white; margin-bottom: 12px; }
.btn-secondary {
    background: rgba(18, 24, 38, 0.95);
    color: #f3f4f8;
    border: 1px solid rgba(255,255,255,0.16);
}
.btn-yandex { background: var(--yandex); color: var(--dark); font-weight: 700; margin-top: 10px; }
#map { width: 100%; height: 100%; min-height: 200px; position: relative; touch-action: none; }
.map-brand-hint {
    position: absolute; bottom: 8px; left: 8px; z-index: 1000;
    background: rgba(0,0,0,0.65); color: #fff; padding: 4px 8px; border-radius: 6px;
    font-size: 0.7rem; white-space: nowrap; pointer-events: none;
}
.map-brand-hint i { margin-right: 4px; opacity: 0.9; }
.route-info {
    position: absolute; top: 72px; left: 16px; right: 16px; background: white; border-radius: var(--radius);
    padding: 16px; box-shadow: var(--shadow); z-index: 1000; display: none;
}
.route-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.route-stat { text-align: center; padding: 8px; }
.route-value { font-size: 1.3rem; font-weight: 700; color: var(--primary); }
.route-label { font-size: 0.75rem; color: var(--gray); margin-top: 4px; }
.current-delivery { background: var(--light); border-radius: 8px; padding: 12px; cursor: pointer; }
.delivery-address { font-weight: 600; margin-bottom: 4px; font-size: 0.95rem; line-height: 1.3; color: #212121; }
.delivery-time { font-size: 0.85rem; color: var(--gray); display: flex; align-items: center; gap: 6px; }
.map-controls { position: absolute; bottom: 100px; right: 16px; z-index: 1000; display: flex; flex-direction: column; gap: 12px; }
.map-control {
    width: 48px; height: 48px; border-radius: 50%; background: white; border: none; box-shadow: var(--shadow);
    display: flex; align-items: center; justify-content: center; font-size: 1.2rem; color: var(--dark); cursor: pointer;
}
.map-control-yandex { background: var(--yandex); color: var(--dark); font-weight: bold; }
.details-panel {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: #05070b;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 25px rgba(0,0,0,0.55);
    z-index: 1002;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border-top: 1px solid rgba(255,255,255,0.12);
}
.details-panel.active { transform: translateY(0); }
.details-handle { padding: 16px; display: flex; justify-content: center; border-bottom: 1px solid var(--border); cursor: pointer; }
.handle-bar { width: 40px; height: 5px; background: var(--border); border-radius: 3px; }
.details-content { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0; }
.details-header { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: white; padding: 20px; }
.delivery-number { font-size: 0.9rem; opacity: 0.9; margin-bottom: 4px; }
.delivery-full-address { font-size: 1.1rem; font-weight: 600; line-height: 1.3; margin-bottom: 8px; }
.details-body {
    padding: 18px 18px 20px;
    background: radial-gradient(circle at top, #111826 0%, #05070b 55%, #000 100%);
    color: #f3f4f8;
}
.client-info-card {
    background: rgba(15, 23, 42, 0.95);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    border: 1px solid rgba(148,163,184,0.25);
}
.client-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.client-avatar {
    width: 44px; height: 44px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex; align-items: center; justify-content: center; color: white; font-weight: 700; font-size: 1rem; flex-shrink: 0;
}
.client-name { font-weight: 600; margin-bottom: 4px; font-size: 1.1rem; }
.client-phone { color: var(--primary); font-weight: 500; display: flex; align-items: center; gap: 8px; font-size: 0.95rem; }
.info-section { margin-bottom: 18px; }
.info-title {
    font-size: 0.85rem;
    color: rgba(148,163,184,0.9);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.info-content {
    background: rgba(15, 23, 42, 0.95);
    border-radius: 10px;
    padding: 10px 12px;
    border: 1px solid rgba(30,64,175,0.5);
    font-size: 0.9rem;
    line-height: 1.4;
    color: #e5e7eb;
}
.status-badge { display: inline-block; padding: 6px 12px; border-radius: 20px; font-size: 0.85rem; font-weight: 600; }
.status-pending { background: #FFF3CD; color: #856404; }
.status-delivered { background: #D4EDDA; color: #155724; }
.action-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 24px 0; }
.orders-panel {
    position: fixed;
    top: var(--header-height); left: 0; bottom: 0;
    width: 100%; max-width: 400px;
    background: #05070b;
    z-index: 1003;
    transform: translateX(-100%);
    transition: transform 0.4s;
    box-shadow: 8px 0 30px rgba(0,0,0,0.75);
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(148,163,184,0.38);
}
.orders-panel.active { transform: translateX(0); }
.orders-panel .route-label { color: rgba(255,255,255,0.82); }
.orders-panel .route-value { color: #fff; }
.orders-header {
    padding: 18px 18px 14px;
    background: linear-gradient(135deg, #0f172a, #1e293b);
    color: #f8fafc;
    border-bottom: 1px solid rgba(148,163,184,0.35);
}
.orders-list {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #0f172a;
}
.order-item {
    padding: 14px 18px;
    border-bottom: 1px solid rgba(71,85,105,0.5);
    cursor: pointer;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    background: rgba(30,41,59,0.98);
}
.order-item:nth-child(even) {
    background: rgba(30,41,59,0.92);
}
.order-item.active {
    background: linear-gradient(90deg, rgba(248,113,113,0.22), rgba(30,41,59,0.98));
    border-left: 4px solid var(--primary);
}
.order-item-dragging { opacity: 0.6; }
.order-item-drag-over { background: rgba(71,85,105,0.6) !important; border-top: 2px solid var(--primary); }
.order-drag-handle {
    padding: 4px 2px; cursor: grab; color: rgba(255,255,255,0.5); flex-shrink: 0; touch-action: none;
}
.order-drag-handle:active { cursor: grabbing; }
.order-number {
    width: 28px; height: 28px; background: var(--primary); color: white; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 0.9rem; flex-shrink: 0;
}
.order-content { flex: 1; color: #f1f5f9; }
.order-address {
    font-weight: 600;
    margin-bottom: 6px;
    line-height: 1.35;
    font-size: 0.95rem;
    color: #f8fafc;
}
.order-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(71,85,105,0.7);
    color: #e2e8f0;
}
.order-status:empty { display: none; }
.bottom-panel {
    position: fixed; bottom: 0; left: 0; right: 0; background: white; border-top: 1px solid var(--border); z-index: 1001;
    padding: 12px 16px; display: flex; gap: 12px; box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}
.bottom-btn {
    flex: 1; padding: 14px; border-radius: 10px; border: none; background: var(--light); color: var(--dark);
    font-weight: 600; font-size: 0.9rem; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer;
}
.bottom-btn.active { background: var(--primary); color: white; }
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1001; opacity: 0; visibility: hidden; transition: 0.3s; }
.overlay.active { opacity: 1; visibility: visible; }
.notification {
    position: fixed; top: 70px; left: 50%; transform: translateX(-50%) translateY(-20px);
    background: var(--dark); color: white; padding: 14px 24px; border-radius: 10px; z-index: 2000; opacity: 0; transition: 0.3s; max-width: 90%; text-align: center; font-weight: 500;
}
.notification.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.loader {
    display: none; position: fixed; inset: 0; background: rgba(255,255,255,0.95); z-index: 2000;
    justify-content: center; align-items: center; flex-direction: column; gap: 20px;
}
.loader.active { display: flex; }
.spinner { width: 60px; height: 60px; border: 4px solid rgba(255,77,77,0.1); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { text-align: center; padding: 40px 20px; color: var(--gray); }
.empty-state i { font-size: 3rem; margin-bottom: 16px; opacity: 0.5; }
@media (min-width: 768px) {
    .route-info { max-width: 400px; right: auto; }
    .bottom-panel { display: none; }
    .details-panel { max-width: 500px; left: auto; right: 20px; bottom: 20px; border-radius: var(--radius); max-height: 70vh; }
}
@media (max-width: 767px) { .header-title span { display: none; } .map-controls { bottom: 80px; } }
