body {
    margin: 0;
    font-family: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", sans-serif;
    background-color: #f4f6f9;
    color: #333;
}

.app-header {
    background-color: #ffffff;
    padding: 10px 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
}

@media (min-width: 768px) {
    .app-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 15px 30px;
    }
}

.app-header h1 {
    margin: 0;
    font-size: 1.2rem;
    color: #2c3e50;
}

.legend { display: flex; gap: 5px; flex-wrap: wrap; }
.badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    color: #fff;
    font-weight: bold;
}
.status-unstarted { background-color: #3498db; } /* 通常を青に変更 */
.status-ongoing   { background-color: #2ecc71; }
.status-completed { background-color: #95a5a6; }

.app-container {
    display: flex;
    flex-direction: column;
    max-width: 1400px;
    margin: 10px auto;
    padding: 0 10px;
    gap: 15px;
    position: relative;
}

@media (min-width: 768px) {
    .app-container {
        flex-direction: row;
        padding: 0 20px;
        gap: 10px;
        margin: 20px auto;
    }
}

#external-events {
    width: auto;
    background: #ffffff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    height: fit-content;
    max-height: 200px;
    overflow-y: auto;
    transition: all 0.3s ease;
    opacity: 1;
}

@media (min-width: 768px) {
    #external-events {
        width: 250px;
        max-height: 80vh;
    }
    #external-events.collapsed {
        width: 0;
        padding: 0;
        margin: 0;
        opacity: 0;
        overflow: hidden;
        pointer-events: none;
    }
}

@media (max-width: 767px) {
    #external-events.collapsed {
        display: none;
    }
}

.fc-event, .custom-event-card {
    cursor: grab !important;
    padding: 8px 10px !important;
    margin-bottom: 8px !important;
    border-radius: 6px !important;
    border: none !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    color: #fff !important;
    font-size: 0.8rem !important;
    font-weight: 500;
    list-style: none;
    user-select: none;
    -webkit-user-select: none;
}

.fc-event:active, .custom-event-card:active {
    cursor: grabbing !important;
}

#calendar-container {
    flex: 1;
    background: #ffffff;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    overflow-x: auto;
}

.fc {
    font-size: 0.85rem !important;
}
.fc .fc-toolbar {
    flex-direction: column;
    gap: 8px;
}
@media (min-width: 768px) {
    .fc .fc-toolbar {
        flex-direction: row;
    }
}

.fc-event-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.return-kanban-btn {
    background: rgba(255, 255, 255, 0.25);
    border: none;
    color: #fff;
    font-size: 0.7rem;
    padding: 1px 5px;
    border-radius: 4px;
    cursor: pointer;
    margin-left: 5px;
    font-weight: bold;
    transition: background 0.2s;
    white-space: nowrap;
}

.return-kanban-btn:hover {
    background: rgba(255, 255, 255, 0.45);
}

#toggle-kanban-btn {
    background: #ffffff;
    border: 1px solid #ddd;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    cursor: pointer;
    font-size: 0.8rem;
    color: #7f8c8d;
    padding: 10px 4px;
    border-radius: 4px;
    align-self: center;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    outline: none;
}
#toggle-kanban-btn:hover {
    background: #34495e;
    color: #fff;
}
@media (max-width: 767px) {
    #toggle-kanban-btn {
        width: 100%;
        padding: 6px;
        transform: rotate(90deg);
    }
}

.archive-btn {
    background-color: #7f8c8d;
    color: white;
    border: none;
    padding: 3px 8px;
    font-size: 0.75rem;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}
.archive-btn:hover {
    background-color: #2c3e50;
}

.fc-daygrid-day-frame {
    max-height: none !important;
    overflow-y: visible !important;
}

.fc-event-draggable {
    cursor: pointer !important;
}

.工事詳細-popup {
    position: absolute;
    z-index: 9999;
    background-color: #2c3e50;
    color: #ffffff;
    padding: 12px;
    border-radius: 6px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    font-size: 0.8rem;
    line-height: 1.5;
    max-width: 280px;
    pointer-events: none; 
    border-left: 5px solid #d4af37; 
}

.popup-row {
    margin-bottom: 4px;
}
.popup-row strong {
    color: #f1c40f;
}