/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
    background: #EFEFF4;
    color: #000;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    line-height: 20px;
}

#app {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
}

/* ===== Header ===== */
.app-header {
    background: #007AFF;
    color: #fff;
    padding: 16px 20px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header h1 {
    font-size: 18px;
    font-weight: 600;
}

.app-header .user-name {
    font-size: 13px;
    opacity: 0.8;
}

.header-back {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    margin-right: 8px;
}

.header-logout {
    background: rgba(255,255,255,0.12);
    border: none;
    color: rgba(255,255,255,0.7);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.header-logout:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

/* ===== Navigation ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: #fff;
    border-top: 0.5px solid #E1E1E1;
    display: flex;
    z-index: 100;
}

.bottom-nav button {
    flex: 1;
    padding: 10px 0;
    border: none;
    background: none;
    font-size: 12px;
    color: #939C9D;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: color 0.2s;
}

.bottom-nav button.active {
    color: #007AFF;
}

.bottom-nav button .nav-icon {
    font-size: 20px;
}

/* ===== Content ===== */
.page-content {
    padding: 16px;
    padding-bottom: 140px;
}

.page-content-chat {
    display: flex;
    flex-direction: column;
    height: calc(100dvh - 56px);
    overflow: hidden;
    padding-bottom: 0 !important;
}

.page-content-chat .tabs {
    flex-shrink: 0;
    margin-bottom: 8px;
}

/* ===== Actions Blur (before arrival) ===== */
.actions-blurred {
    filter: blur(4px);
    pointer-events: none;
    user-select: none;
    opacity: 0.7;
    transition: filter 0.3s, opacity 0.3s;
}

.actions-arrive-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.arrive-overlay-content {
    text-align: center;
    background: rgba(255,255,255,0.92);
    border-radius: 16px;
    padding: 24px 32px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

/* ===== Step-based Task Detail ===== */
.step-page {
    display: flex;
    flex-direction: column;
    min-height: calc(100dvh - 56px);
    padding: 0 16px 140px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.step-card {
    text-align: center;
    padding: 24px 16px 20px;
}

.step-card-done {
    opacity: 0.9;
}

.step-icon {
    font-size: 48px;
    margin-bottom: 27px;
}

.step-title {
    font-size: 22px;
    font-weight: 700;
    color: #000;
    margin-bottom: 6px;
}

.step-description {
    font-size: 14px;
    color: #707579;
}

.step-section {
    margin-bottom: 16px;
}

.step-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #707579;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

/* Location card */
.step-location-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0px 2px 8px rgba(9, 60, 102, 0.08);
}

.step-location-clickable {
    cursor: pointer;
    align-items: center;
}

.step-location-clickable:active {
    opacity: 0.7;
}

.step-location-chevron {
    font-size: 24px;
    color: #939C9D;
    flex-shrink: 0;
    margin-left: auto;
}

.step-location-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.step-location-info {
    flex: 1;
    min-width: 0;
}

.step-location-name {
    font-size: 16px;
    font-weight: 600;
    color: #000;
}

.step-location-address {
    font-size: 14px;
    color: #707579;
    margin-top: 4px;
}

.step-location-desc {
    font-size: 13px;
    color: #939C9D;
    margin-top: 4px;
}

.step-map-wrap {
    height: 180px;
    border-radius: 16px;
    overflow: hidden;
    margin-top: 10px;
}

.step-map-wrap .leaflet-container {
    height: 100%;
    width: 100%;
}

/* Скрываем атрибуцию Leaflet */
.leaflet-control-attribution {
    display: none !important;
}

.step-map-btn {
    display: block;
    text-align: center;
    margin-top: 10px;
    text-decoration: none;
}

/* Subtask preview */
.step-subtask-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #fff;
    border-radius: 12px;
    margin-bottom: 8px;
    font-size: 15px;
    color: #333;
    box-shadow: 0px 2px 8px rgba(9, 60, 102, 0.08);
}

.step-subtask-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #007AFF;
    flex-shrink: 0;
}

/* Progress */
.step-progress {
    margin-bottom: 16px;
}

.step-progress-bar {
    height: 6px;
    background: #e8e8e8;
    border-radius: 3px;
    overflow: hidden;
}

.step-progress-fill {
    height: 100%;
    background: #007AFF;
    border-radius: 3px;
    transition: width 0.4s ease;
}

/* Subtask list */
.step-subtask-list {
    /* list of subtasks */
}

.step-subtask-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: #fff;
    border-radius: 16px;
    margin-bottom: 8px;
    box-shadow: 0px 2px 8px rgba(9, 60, 102, 0.08);
    transition: all 0.2s;
}

.step-subtask-item.subtask-active {
    border: 2px solid #007AFF;
    box-shadow: 0 2px 12px rgba(0,122,255,0.12);
}

.step-subtask-item.subtask-done {
    opacity: 0.6;
}

.step-subtask-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.step-subtask-check {
    font-size: 18px;
    flex-shrink: 0;
}

.step-subtask-name {
    font-size: 15px;
    font-weight: 500;
    color: #000;
}

.step-subtask-status {
    font-size: 12px;
    color: #939C9D;
    margin-top: 2px;
}

/* Door status cards */
.door-status-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0px 2px 8px rgba(9, 60, 102, 0.08);
}

.door-status-card.warning {
    background: #fff8e1;
    border: 1px solid #ffe082;
}

.door-status-text {
    font-size: 16px;
    font-weight: 500;
    color: #000;
}

.step-door-mini {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 13px;
    color: #4caf50;
    margin-top: auto;
}

.step-door-top {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 13px;
    color: #34C759;
    background: #F0FFF4;
    border-radius: 12px;
    margin: 16px 16px 4px 16px;
}

/* Footer */
.step-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px 16px calc(env(safe-area-inset-bottom, 0px) + 12px) 16px;
    background: #fff;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
    z-index: 50;
}

.step-footer .btn {
    width: 100%;
}

.btn-lg {
    padding: 16px 24px;
    font-size: 17px;
    font-weight: 600;
}

/* ===== Support Tickets ===== */
.ticket-card {
    padding: 14px 16px;
    background: #fff;
    border-radius: 16px;
    margin-bottom: 8px;
    box-shadow: 0px 2px 8px rgba(9, 60, 102, 0.08);
    cursor: pointer;
    transition: box-shadow 0.2s;
}

.ticket-card:active {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

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

.ticket-topic {
    font-size: 15px;
    font-weight: 500;
    color: #000;
    flex: 1;
    min-width: 0;
}

.ticket-status {
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 8px;
    flex-shrink: 0;
}

.ticket-status-active {
    background: #e3f2fd;
    color: #007AFF;
}

.ticket-status-closed {
    background: #f0f0f0;
    color: #939C9D;
}

.ticket-status-pending {
    background: #fff8e1;
    color: #f57c00;
}

.ticket-card-bottom {
    margin-top: 6px;
}

.ticket-date {
    font-size: 12px;
    color: #939C9D;
}

.form-group-support {
    margin-bottom: 16px;
}

.form-group-support label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #707579;
    margin-bottom: 6px;
}

.form-group-support input,
.form-group-support textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #E1E1E1;
    border-radius: 12px;
    background: #F6F6F6;
    color: #000;
    font-size: 15px;
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group-support input:focus,
.form-group-support textarea:focus {
    border-color: #007AFF;
    background: #fff;
}

.form-group-support textarea {
    resize: vertical;
    min-height: 80px;
}

/* Chat read status */
.chat-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: flex-end;
}

.chat-read-status {
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

.chat-read-status.read {
    color: #007AFF;
}

.chat-read-status.unread {
    color: #939C9D;
}

.chat-read-status svg {
    display: block;
}

.support-footer-btn {
    position: fixed;
    bottom: 62px;
    left: 0;
    right: 0;
    padding: 12px 16px;
    background: #EFEFF4;
    z-index: 90;
}

.support-footer-btn .btn {
    width: 100%;
}

.chat-closed-bar {
    text-align: center;
    padding: 14px;
    color: #939C9D;
    font-size: 14px;
    background: #F6F6F6;
    border-top: 1px solid #eee;
}

/* ===== Schedule ===== */
.step-schedule-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0px 2px 8px rgba(9, 60, 102, 0.08);
}

.step-schedule-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.schedule-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dot-open { background: #34C759; }
.dot-closed { background: #FF3B30; }

.schedule-status-text {
    font-size: 15px;
    font-weight: 500;
    color: #000;
}

.step-schedule-hours {
    font-size: 15px;
    font-weight: 500;
    color: #007AFF;
}

/* Schedule in modal */
.schedule-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 14px;
    color: #000;
}

.schedule-row.schedule-today {
    font-weight: 600;
    color: #007AFF;
}

.schedule-day {
    width: 30px;
}

.schedule-time {
    color: #707579;
}

.schedule-off {
    color: #FF3B30;
}

/* Photo viewer */
.photo-viewer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.9);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-viewer-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.2);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    z-index: 2001;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-viewer-container {
    width: 100%;
    height: 100%;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-compact {
    max-width: 360px;
}

.modal-footer {
    padding: 0 20px 20px;
}

.door-confirm-text {
    font-size: 15px;
    color: #000;
    line-height: 1.5;
    margin-bottom: 20px;
}

.door-confirm-checkbox {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 15px;
    color: #000;
    -webkit-user-select: none;
    user-select: none;
}

.checkbox-icon {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 2px solid #D1D1D6;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.checkbox-icon.checked {
    background: #007AFF;
    border-color: #007AFF;
}

.detail-info-copyable {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.detail-info-copyable:active {
    opacity: 0.6;
}

.copy-icon {
    font-size: 14px;
    flex-shrink: 0;
}

.photo-viewer-counter {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.8);
    font-size: 14px;
    font-weight: 500;
    z-index: 2001;
    background: rgba(0,0,0,0.4);
    padding: 4px 14px;
    border-radius: 1000px;
}

.photo-viewer-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border: none;
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-size: 28px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 2001;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-viewer-prev {
    left: 12px;
}

.photo-viewer-next {
    right: 12px;
}

.photo-viewer-img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    transform-origin: center center;
    transition: transform 0.3s ease;
    cursor: zoom-in;
    border-radius: 8px;
}

.photo-viewer-img.zoomed {
    cursor: zoom-out;
    max-width: none;
    max-height: none;
}

/* Detail photos */
.detail-photos {
    margin-bottom: 16px;
}

.detail-photos-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
}

.detail-photos-scroll::-webkit-scrollbar {
    display: none;
}

.detail-photo-img {
    width: 200px;
    height: 150px;
    object-fit: cover;
    border-radius: 16px;
    flex-shrink: 0;
    cursor: pointer;
}

/* Detail modal blocks */
.detail-map-wrap {
    height: 200px;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 16px;
}

.detail-info-block {
    margin-bottom: 16px;
    padding: 14px 16px;
    background: #F6F6F6;
    border-radius: 16px;
}

.detail-info-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 6px 0;
}

.detail-info-row + .detail-info-row {
    border-top: 0.5px solid #E1E1E1;
}

.detail-info-label {
    font-size: 14px;
    color: #707579;
    flex-shrink: 0;
}

.detail-info-value {
    font-size: 14px;
    font-weight: 500;
    color: #000;
    text-align: right;
    margin-left: 12px;
}

/* ===== Schedule Accordion ===== */
.schedule-accordion {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0px 2px 8px rgba(9, 60, 102, 0.08);
    overflow: hidden;
    cursor: pointer;
}

.schedule-accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
}

.schedule-accordion-left {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #000;
}

.schedule-today-hours {
    color: #707579;
    font-size: 13px;
}

.schedule-accordion-arrow {
    font-size: 20px;
    color: #939C9D;
    transition: transform 0.2s;
    transform: rotate(0deg);
}

.schedule-accordion-arrow.open {
    transform: rotate(90deg);
}

.schedule-accordion-body {
    padding: 0 16px 14px;
    border-top: 1px solid #EFEFF4;
}

.schedule-accordion-body .schedule-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
    color: #707579;
}

.schedule-accordion-body .schedule-row.schedule-today {
    color: #000;
    font-weight: 600;
}

.schedule-accordion-body .schedule-off {
    color: #FF3B30;
}

/* ===== Snackbar ===== */
.snack {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 12px 24px;
    border-radius: 1000px;
    font-size: 15px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 3000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    cursor: pointer;
    animation: snack-in 0.3s ease;
    white-space: nowrap;
}

@keyframes snack-in {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.snack-icon {
    font-size: 18px;
}

/* ===== Work Checklist ===== */
.work-checklist {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0px 2px 8px rgba(9, 60, 102, 0.08);
    overflow: hidden;
}

.work-checklist-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    border-bottom: 0.5px solid #EFEFF4;
    cursor: pointer;
    transition: opacity 0.2s;
    -webkit-user-select: none;
    user-select: none;
}

.work-checklist-item:last-child {
    border-bottom: none;
}

.work-checklist-item.done {
    opacity: 0.5;
}

.work-checklist-item.current {
    background: #F8FAFF;
}

.work-checklist-label {
    font-size: 15px;
    color: #000;
    line-height: 1.4;
}

.work-checklist-item.done .work-checklist-label {
    text-decoration: line-through;
    color: #939C9D;
}

/* ===== Subtask Step ===== */
.step-action-card {
    padding: 20px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0px 2px 8px rgba(9, 60, 102, 0.08);
    text-align: center;
}

.step-action-text {
    font-size: 16px;
    font-weight: 500;
    color: #000;
    line-height: 1.5;
}

.step-action-status {
    font-size: 15px;
    color: #707579;
}

.step-action-status:not(:first-child) {
    margin-top: 16px;
}

.step-photo-preview {
    width: 100%;
    border-radius: 16px;
    max-height: 300px;
    object-fit: cover;
    box-shadow: 0px 2px 8px rgba(9, 60, 102, 0.08);
}

/* ===== Actions Tab Layout ===== */
.actions-tab {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: calc(100dvh - 56px - 80px);
}

.actions-tab-content {
    flex: 1;
    position: relative;
}

.actions-tab-footer {
    padding: 12px 0;
    margin-top: auto;
}

.actions-tab-footer .door-warning {
    margin-bottom: 10px;
}

.actions-tab-footer .btn {
    width: 100%;
}

/* ===== Login ===== */
.login-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: #fff;
}

.login-logo-img {
    margin-bottom: 16px;
}

.login-logo-img img {
    width: 120px;
    height: auto;
}

.login-title {
    color: #000;
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}

.login-subtitle {
    color: #939C9D;
    font-size: 14px;
    margin-bottom: 36px;
}

.login-form {
    width: 100%;
    max-width: 320px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    color: #707579;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid #E1E1E1;
    border-radius: 12px;
    background: #F6F6F6;
    color: #000;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: #007AFF;
    background: #fff;
}

.form-group input::placeholder {
    color: #bbb;
}

.code-input {
    text-align: center;
    font-size: 24px !important;
    letter-spacing: 8px;
    font-weight: 700;
}

.code-sent-info {
    text-align: center;
    margin-bottom: 20px;
    padding: 16px;
    background: #f0f7ff;
    border-radius: 12px;
}

.code-sent-info p:first-child {
    font-size: 15px;
    font-weight: 600;
    color: #000;
}

.code-sent-to {
    font-size: 14px;
    color: #007AFF;
    margin-top: 4px;
    font-weight: 600;
}

.login-tg-info {
    text-align: center;
    padding: 24px 16px;
    background: #f0f7ff;
    border-radius: 16px;
    margin-bottom: 20px;
}

.login-tg-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.login-tg-text {
    font-size: 15px;
    color: #707579;
    line-height: 1.5;
    margin-bottom: 20px;
}

.login-error-text {
    font-size: 14px;
    color: #FF3B30;
    line-height: 1.5;
    margin-bottom: 20px;
}

.login-tg-btn {
    text-decoration: none;
    display: inline-flex;
}

.login-checking {
    text-align: center;
    padding: 16px;
}

.login-checking p {
    margin-top: 8px;
    font-size: 13px;
    color: #939C9D;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 24px;
    border: none;
    border-radius: 1000px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.btn-primary {
    background: #007AFF;
    color: #fff;
}

.btn-primary:hover {
    background: #0062CC;
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-success {
    background: #66bb6a;
    color: #fff;
}

.btn-success:hover {
    background: #4caf50;
}

.btn-warning {
    background: #ffa726;
    color: #fff;
}

.btn-warning:hover {
    background: #007AFF;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 1000px;
    width: auto;
    flex-shrink: 0;
}

/* ===== Error ===== */
.error-message {
    background: #ef5350;
    color: #fff;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 16px;
    text-align: center;
}

/* ===== Tabs ===== */
.tabs {
    display: flex;
    background: #e8e8e8;
    border-radius: 12px;
    padding: 3px;
    margin-bottom: 16px;
}

.tab {
    flex: 1;
    padding: 10px 0;
    border: none;
    background: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #707579;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.tab.active {
    background: #fff;
    color: #007AFF;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.tab-badge {
    background: #007AFF;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.tab-badge-grey {
    background: #999;
}

/* ===== Filters ===== */
.filters {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.filter-btn {
    padding: 8px 16px;
    border: 1.5px solid #E1E1E1;
    border-radius: 1000px;
    background: #fff;
    font-size: 14px;
    font-weight: 500;
    color: #707579;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.filter-btn.active {
    background: #007AFF;
    color: #fff;
    border-color: #007AFF;
}

/* ===== Task Card ===== */
.task-card {
    background: #fff;
    border-radius: 16px;
    padding: 14px 16px;
    margin-bottom: 8px;
    box-shadow: 0px 2px 8px rgba(9, 60, 102, 0.08);
    cursor: pointer;
    transition: transform 0.15s;
}

.task-card:active {
    transform: scale(0.98);
}

.task-card-row-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.task-card-left {
    display: flex;
    align-items: baseline;
    gap: 4px;
    min-width: 0;
    flex: 1;
}

.task-device-name {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.task-card-address {
    font-size: 12px;
    color: #707579;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.task-priority {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
    flex-shrink: 0;
}

.priority-high {
    background: #ffebee;
    color: #e53935;
}

.priority-medium {
    background: #fff3e0;
    color: #0070E0;
}

.priority-low {
    background: #e8f5e9;
    color: #43a047;
}

.priority-default, .priority-null, .priority-normal {
    background: #f5f5f5;
    color: #707579;
}

.task-card-row-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.task-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.task-status {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 6px;
    white-space: nowrap;
}

.status-new {
    background: #e3f2fd;
    color: #1976d2;
}

.status-in_progress {
    background: #fff3e0;
    color: #0062CC;
}

.status-done {
    background: #e8f5e9;
    color: #388e3c;
}

.task-subtasks-badge {
    font-size: 11px;
    color: #939C9D;
    white-space: nowrap;
}

.progress-bar-mini {
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    overflow: hidden;
    flex: 1;
    max-width: 60px;
}

.task-time {
    font-size: 11px;
    color: #bbb;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ===== Task Detail ===== */
.detail-section {
    background: #fff;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.detail-section h3 {
    font-size: 14px;
    color: #939C9D;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f5f5f5;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    color: #666;
    font-size: 14px;
}

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

/* ===== Subtask ===== */
.subtask-card {
    background: #F6F6F6;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 8px;
    border-left: 3px solid #e0e0e0;
}

.subtask-card:last-child {
    margin-bottom: 0;
}

.subtask-card.subtask-done {
    border-left-color: #66bb6a;
    opacity: 0.7;
}

.subtask-card.subtask-new {
    border-left-color: #4fc3f7;
}

.subtask-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.subtask-check {
    font-size: 18px;
    flex-shrink: 0;
}

.subtask-name {
    font-size: 14px;
    font-weight: 600;
}

.subtask-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.subtask-status-text {
    font-size: 12px;
    color: #939C9D;
}

.subtask-btn {
    padding: 6px 16px;
    border: none;
    border-radius: 8px;
    background: #4fc3f7;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.subtask-btn:hover {
    background: #29b6f6;
}

.subtask-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== Actions ===== */
.actions {
    padding: 16px;
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: #fff;
    border-top: 1px solid #e0e0e0;
    z-index: 100;
}

/* ===== Arrive Block ===== */
.arrive-block {
    text-align: center;
    padding: 8px 0;
}

.arrive-icon {
    font-size: 40px;
    margin-bottom: 8px;
}

.arrive-text {
    font-size: 15px;
    color: #707579;
}

/* ===== Door Block ===== */
.door-block {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.door-block .btn {
    width: auto;
    flex-shrink: 0;
}

.door-status-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.door-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.door-indicator.door-closed {
    background: #66bb6a;
    box-shadow: 0 0 6px rgba(102, 187, 106, 0.5);
}

.door-indicator.door-opened {
    background: #ef5350;
    box-shadow: 0 0 6px rgba(239, 83, 80, 0.5);
    animation: pulse 1.5s ease infinite;
}

.door-status-label {
    font-size: 15px;
    font-weight: 600;
}

/* ===== Door Warning ===== */
.door-warning {
    background: #fff3e0;
    color: #004999;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 10px;
    text-align: center;
    animation: pulse 2s ease infinite;
}

/* ===== Stats ===== */
.stats-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    background: #fff;
    border-radius: 16px;
    padding: 16px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 13px;
    color: #939C9D;
}

.stat-value.blue { color: #1976d2; }
.stat-value.green { color: #388e3c; }
.stat-value.orange { color: #0062CC; }
.stat-value.grey { color: #666; }

/* ===== Loading ===== */
.loading {
    text-align: center;
    padding: 40px;
    color: #939C9D;
}

.spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid #e0e0e0;
    border-top-color: #000;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 20px;
    color: #939C9D;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100dvh - 56px - 80px - 60px);
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 25px;
}

.empty-state p {
    font-size: 15px;
}

/* ===== Progress Bar ===== */
.progress-bar {
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-fill {
    height: 100%;
    background: #4fc3f7;
    border-radius: 3px;
    transition: width 0.3s;
}

/* ===== Device Info ===== */
.device-meters {
    display: flex;
    gap: 16px;
    margin-top: 8px;
}

.meter {
    flex: 1;
}

.meter-label {
    font-size: 12px;
    color: #939C9D;
    margin-bottom: 4px;
}

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

/* ===== Location / Map ===== */
.task-address {
    font-size: 13px;
    color: #707579;
    margin-bottom: 2px;
}

.task-address-desc {
    font-size: 12px;
    color: #939C9D;
    margin-bottom: 6px;
}

.task-map-link {
    margin-bottom: 6px;
}

.map-btn {
    display: inline-block;
    padding: 4px 12px;
    background: #e3f2fd;
    color: #1976d2;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s;
}

.map-btn:hover {
    background: #bbdefb;
}

.btn-map {
    display: block;
    text-align: center;
    margin-top: 12px;
    margin-bottom: 12px;
    background: #e3f2fd;
    color: #1976d2;
    text-decoration: none;
}

.btn-map:hover {
    background: #bbdefb;
}

.detail-map {
    margin-top: 12px;
}

.map-iframe {
    width: 100%;
    height: 200px;
    border: none;
    border-radius: 12px;
    margin-top: 8px;
}

/* ===== Device Compact ===== */
.device-compact-name {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.device-compact-address {
    font-size: 13px;
    color: #666;
    margin-bottom: 10px;
}

.device-compact-buttons {
    display: flex;
    gap: 8px;
}

.btn-outline {
    background: #fff;
    color: #007AFF;
    border: 1.5px solid #E1E1E1;
    white-space: nowrap;
    width: auto;
}

.btn-outline:hover {
    background: #F6F6F6;
    border-color: #CFCFCF;
}

.btn-map-compact {
    display: inline-flex;
    align-items: center;
    background: #e3f2fd;
    color: #1976d2;
    text-decoration: none;
    white-space: nowrap;
}

.btn-map-compact:hover {
    background: #bbdefb;
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: fadeIn 0.15s ease;
}

.modal {
    background: #fff;
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    border-radius: 20px 20px 0 0;
    overflow-y: auto;
    animation: slideUp 0.25s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid #f0f0f0;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
    border-radius: 20px 20px 0 0;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: #f5f5f5;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: background 0.2s;
}

.modal-close:hover {
    background: #e0e0e0;
}

.modal-body {
    padding: 16px 20px 24px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* ===== Workflow ===== */
.workflow-step {
    text-align: center;
    padding: 12px 0;
}

.workflow-icon {
    font-size: 56px;
    margin-bottom: 12px;
}

.workflow-text {
    font-size: 16px;
    color: #333;
    margin-bottom: 8px;
    line-height: 1.4;
}

.workflow-photo-preview {
    margin-top: 16px;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid #e0e0e0;
}

.workflow-photo-preview img {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    display: block;
}

.workflow-uploading {
    text-align: center;
    padding: 16px 0;
}

.btn.disabled,
label.btn.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.workflow-status-block {
    margin-top: 20px;
    text-align: center;
}

.workflow-status-icon {
    font-size: 40px;
    margin-bottom: 8px;
}

.workflow-status-text {
    font-size: 15px;
    color: #707579;
}

.workflow-status-icon.status-pending {
    animation: pulse 1.5s ease infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ===== Chat ===== */
.chat-container {
    display: flex;
    flex-direction: column;
    background: #e8e8e8;
    margin: 0 -16px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 8px 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
}

.chat-message {
    display: flex;
}

.chat-mine {
    justify-content: flex-end;
}

.chat-other {
    justify-content: flex-start;
}

.chat-bubble {
    max-width: 78%;
    padding: 8px 12px;
    border-radius: 16px;
    font-size: 15px;
    line-height: 1.45;
    word-break: break-word;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.chat-mine .chat-bubble {
    background: #dcf8c6;
    border-bottom-right-radius: 4px;
    color: #111;
}

.chat-other .chat-bubble {
    background: #fff;
    border-bottom-left-radius: 4px;
    color: #111;
}

.chat-author {
    font-size: 12px;
    font-weight: 700;
    color: #004999;
    margin-bottom: 2px;
}

.chat-text {
    color: #000;
}

.chat-photo {
    max-width: 100%;
    border-radius: 8px;
    margin-top: 4px;
    cursor: pointer;
}

.chat-time {
    font-size: 11px;
    color: #777;
    text-align: right;
    margin-top: 2px;
}

.chat-input-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f5f5f5;
    border-top: 1px solid #ddd;
    flex-shrink: 0;
}

.chat-photo-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #666;
    transition: color 0.2s;
}

.chat-photo-btn:hover {
    color: #007AFF;
}

.chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ccc;
    border-radius: 24px;
    font-size: 15px;
    outline: none;
    background: #fff;
    transition: border-color 0.2s;
}

.chat-input:focus {
    border-color: #007AFF;
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #007AFF;
    color: #fff;
    border: none;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}

.chat-send-btn:hover {
    background: #0062CC;
}

.chat-send-btn:disabled {
    background: #bbb;
    cursor: not-allowed;
}

.chat-photo-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #fff3e0;
    border-top: 1px solid #ddd;
}

.chat-photo-preview img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
}

.chat-photo-preview .remove-preview {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #939C9D;
}
